12%
Instructions
Syntax
temp_in_f = (temp * 9/5) + 32
if unit.lower() == "c":
...Temperature Conversion Program 🌡️
Chapter 1 oda kadasisi project-ku vandhuttom! Idhu romba similar to weight conversion dhaan, aana formulas mattum maarum. Celsius-a Fahrenheit-a maathuvom, illa Fahrenheit-a Celsius-a maathuvom.
The Formulas
- Celsius to Fahrenheit:
F = (C * 9/5) + 32 - Fahrenheit to Celsius:
C = (F - 32) * 5/9
temp = float(input("Enter the temperature: "))
unit = input("Is this Celsius or Fahrenheit? (C or F): ")
if unit.lower() == "c":
# Celsius to Fahrenheit formula
temp_in_f = (temp * 9/5) + 32
print(f"The temperature in Fahrenheit is: {round(temp_in_f, 1)}°F")
elif unit.lower() == "f":
# Fahrenheit to Celsius formula
temp_in_c = (temp - 32) * 5/9
print(f"The temperature in Celsius is: {round(temp_in_c, 1)}°C")
else:
print("Invalid unit! Please enter C or F.")
Idha theliva purinjikka indha interactive visualizer-a test pannunga:
💡 Did You Know? Degree symbol (
°) print panna direct-a"°C"nu string kulla type pannalam. Python 3 default-a emojis, symbols ellam support pannum!
Your Turn! (Unga neram!)
Mela irukka mathiriye ungaloda swondha temperature converter ezhudhunga!
tempandunitvangaradhukkuinput()use pannunga.ifcondition use panni formulas-a apply pannunga.- Output-a f-string use panni
°Cilla°Foda print pannunga!
Help
Temperature Conversion ProgramExercise 10/77 • 50 XP
❴❵ script.py
Terminal