Python practical questions related to variables and arithmetic operations
1. Write a Python program to:
Create three variables: a, b, and c.
Assign values 5, 10, and 15 to them respectively.
Print the sum of these three variables.
2. Write a Python program to:
Take two numbers as input from the user.
Perform addition, subtraction, multiplication, and division operations on these
numbers.
Print the results for each operation.
3.Write a Python program to:
Create two variables, x and y, and assign values 10 and 20 to them.
Swap the values of x and y without using a third variable.
Print the values of x and y after swapping.
4. Write a Python program to:
Take the radius of a circle as input from the user.
Calculate the area of the circle using the formula: Area = π * r².
Print the result.
5. Write a Python program to:
Take temperature in Celsius as input.
Convert it to Fahrenheit using the formula: Fahrenheit = (Celsius * 9/5) + 32.
Print the converted temperature.
6. Write a Python program to:
Take Principal, Rate, and Time as input from the user.
Calculate the compound interest using the formula:
A=P×(1+R/100) T
Where A is the final amount.
Print the compound interest (A - P).
7.Write a Python program to:
Take a number as input from the user.
Check if the number is even or odd.
Print "Even" if the number is even, otherwise print "Odd".
8. Write a Python program to:
Take a three-digit number as input from the user.
Calculate the sum of its digits.
Print the result.
9. Write a Python program to:
Take a number as input from the user.
Calculate the factorial of the number using a loop.
Print the result.