Practic
Practic
Simple Calculator
Problem: Write a Python program that asks the user for two numbers and
then prints the sum, difference, product, and quotient of the two numbers.
Input Example:
Enter first number: 10
Enter second number: 2
Output Example:
Sum: 12
Difference: 8
Product: 20
Quotient: 5
2. Area of a Circle
Problem: Write a Python program that asks the user for the radius of a
circle and then calculates and prints the area. Use the formula area = π *
r^2, where π = 3.14159.
Input Example:
Enter radius: 5
Output Example:
Area of the circle: 78.53975
3. Simple Interest Calculator
Problem: Write a program to calculate the simple interest. The formula is
Simple Interest = (P * R * T) / 100, where P is the principal amount, R is the
rate of interest, and T is the time in years.
Input Example:
Enter principal: 1000
Enter rate of interest: 5
Enter time in years: 3
Output Example:
Simple Interest: 150
4. Temperature Converter
Problem: Write a Python program that asks the user to enter a
temperature in Celsius and converts it to Fahrenheit. The formula is F = (C
* 9/5) + 32.
Input Example:
Enter temperature in Celsius: 25
Output Example:
Temperature in Fahrenheit: 77.0
5. Average of Three Numbers
Problem: Write a Python program that asks the user to enter three
numbers, then calculates and prints the average of these numbers.
Input Example:
Enter first number: 10
Enter second number: 20
Enter third number: 30
Output Example:
Average: 20.0
6. Rectangle Perimeter and Area
Problem: Write a Python program that asks the user to enter the length
and width of a rectangle, then calculates and prints the perimeter and
area.
Input Example:
Enter length: 4
Enter width: 3
Output Example:
Perimeter: 14
Area: 12
7. Minutes to Hours and Minutes
Problem: Write a Python program that takes the number of minutes as
input from the user and converts it into hours and minutes.
Input Example:
Enter total minutes: 130
Output Example:
130 minutes is 2 hours and 10 minutes.
8. Even or Odd
Problem: Write a Python program that asks the user to enter a number
and prints whether the number is even or odd.
Input Example:
Enter a number: 7
Output Example:
7 is an odd number.
9. Age in Days
Problem: Write a Python program that asks the user for their age in years
and then calculates and prints their age in days (assuming 1 year = 365
days).
Input Example: