Python Problems

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Basics Problems

1. Arithmetic operations:

o Write a program that takes two numbers as input from the user and prints all
arithmetic operations.

2. Square of a Number:

o Write a program that takes a number as input from the user and prints the square of
that number.

3. Check Even or Odd:

o Write a program that takes a number as input and checks whether it is even or odd.

4. Simple Interest and Compound Interest Calculation:

o Write a program to calculate simple interest where ( P ) is the principal amount, ( R )


is the rate of interest, and ( T ) is the time period. Find for compound interest also

5. Convert Celsius to Fahrenheit:

o Write a program to convert temperature from Celsius to Fahrenheit. The formula is


( F = \frac{9}{5} \times C + 32 ).

6. Find the Largest of Three Numbers and sum of Largest and Smallest numbers:

o Write a program that takes three numbers as input from the user and prints the
largest of the three then print the sum of largest and smallest numbers

7. Calculate the Area of a Circle:

o Write a program to calculate the area of a circle given its radius. The formula is ( \
text{Area} = \pi \times r^2 ).

8. Calculate the Perimeter of a Rectangle:

o Write a program to calculate the perimeter of a rectangle given its length and width.
The formula is ( \text{Perimeter} = 2 \times (length + width) ).

9. Convert Kilometers to Miles:

o Write a program to convert distance from kilometers to miles. The formula is ( \


text{Miles} = \text{Kilometers} \times 0.621371 ).

10. Check if a Number is Prime:

o Write a program to check if a given number is a prime number.

11. Generate Multiplication Table:

o Write a program to generate the multiplication table of a given number.

12. Calculate the Sum of Natural Numbers:

o Write a program to calculate the sum of the first ( n ) natural numbers.

13. Find the GCD of Two Numbers:

o Write a program to find the greatest common divisor (GCD) of two numbers.
Above Basics Problem (By defining atleast one function)

1. Factorial calculation
2. Leap Year check
3. Count number of digits in a number
4. Sum and product of digits of a number
5. Number to number name (0 to 99)
6. Reverse of a number
7. Sum of even numbers till given number
8. Quadratic equation roots
9. Check for palindrome
10. Check for Armstrong number
11. LCM calculation of two numbers
12. Decimal Number to Binary Number

You might also like