1 Python From Summer Class Revision
1 Python From Summer Class Revision
4. Basics of Python
Popularity: Python is widely used for its simplicity and readability.
IDLE: Integrated Development and Learning Environment for writing Python code.
# Interpretation of BMI
if bmi < 18.5:
print("You are underweight.")
elif 18.5 <= bmi < 24.9:
print("You have a normal weight.")
elif 25 <= bmi < 29.9:
print("You are overweight.")
else:
print("You are obese.")
Lab Activities
Solve following questions using the fundamentals of Python, particularly focusing on variables,
data types, input/output, and basic calculations:
2. Temperature Converter:
Create a program that converts a temperature given in Celsius to Fahrenheit using the
formula:
3. Area of a Rectangle:
Write a program that accepts the length and width of a rectangle from the user and
calculates its area using the formula:
4. Grade Calculator:
Create a program that accepts three exam scores from the user, calculates the average score,
and determines the grade based on the average:
o A: 90 and above
o B: 80 to 89
o C: 70 to 79
o D: 60 to 69
o F: below 60
5. Circle Volume Calculator:
Write a program that calculates the volume of a sphere given its radius. Use the formula:
where π≈3.14\pi \approx 3.14π≈3.14. Ask the user for the radius.