Python Practice Set - 1
Q 1. Write a program to input radius of a circle and display
its Area and Perimeter.
Solution:-
r = float(input("Enter Radius"))
A = 3.14 * r**2
P = 2 * 3.14 * r
print("Area of circle is", A)
print(“Perimeter of circle is", P)
Q 2. Write a program to input two numbers and print quotient
and remainder.
Solution:-
a = int(input("Enter one
number"))
b = int(input("Enter second number"))
print("Quotient", a//b)
print("Remainder", a%b)
Q 3. Write a program to input temperature in Celsius and convert into
Fahrenheit.
Given: 1.8 * C + 32
Solution:-
c = float(input("Enter temp in celsius"))
f = (9/5)*c + 32
print("Temp in Fahrenheit ",f )
Q 4. Write a program to input total minutes and print its equivalent hours
and minute.
Solution:-
minutes = int(input("Enter minutes"))
hour = minutes // 60
minute = minutes % 60
print(hour, "Hour", minute, "Minutes")
Q 5. Write a program to input total seconds and convert into hours, minutes
and seconds.
Solution:-
sec = int(input("Enter seconds"))
minutes = sec // 60
seconds = sec % 60
hour = minutes // 60
minute = minutes % 60
print(hour, "Hours", minute, "Minutes", seconds, "Seconds")
Check Out the Projects Section for various interesting projects and games build with Python.
Post a Comment
For any doubts feel free to ask in comments below.
Stay Connected to Us for more such Courses and Projects.