Premium Only Content

For Loop with Multiple Lists |Section 4|Celestial Warrior
In one of the previous exercises we created the following function that gets Celsius degrees as input and returns Fahrenheit, or a message if the Celsius inputvalue is less than -273.15.
def c_to_f(c):
if c< -273.15:
return "That temperature doesn't make sense!"
else:
f=c*9/5+32
return f
Please implement a for loop that iterates through the following temperatures list temperatures=[10,-20,-289,100]and calls the above c_to_f function in each iteration. In other words, this timeyou are using the function to calculatea series of values instead of just one value.
The expected output:
50.0
-4.0
That temperature doesn't make sense!
212.0
temperatures=[10,-20,-289,100]
def c_to_f(c):
if c< -273.15:
return "That temperature doesn't make sense!"
else:
f=c*9/5+32
return f
for t in temperatures:
print(c_to_f(t))
-
LIVE
The Quartering
1 hour agoThey Just Stopped Another Attack, Trump Defeats Youtube, Hasan PIker Meltdown & More
1,775 watching -
8:54:37
Dr Disrespect
10 hours ago🔴LIVE - DR DISRESPECT - BABY STEPS - TO THE TIPPITY TOP
177K16 -
LIVE
Drew Hernandez
7 hours agoTRUMP'S NEW GAZA PEACE PLAN & NETANYAHU LAUNCHES NEW SOCIAL MEDIA OP
625 watching -
LIVE
FreshandFit
8 hours agoMoney Monday Call-In Show w/ Steve From Accounting
1,148 watching -
3:07:28
Nikko Ortiz
4 hours agoArena Breakout Better Than Tarkov? - Rumble LIVE
32.6K2 -
35:44
MattMorseTV
3 hours ago $10.17 earned🔴Schumer just WALKED INTO Trump's TRAP.🔴
31.2K57 -
2:41:44
BubbaMatt
12 hours ago $0.46 earnedMafia Definitive Edition Playthrough - Part 5
13.7K1 -
51:25
Donald Trump Jr.
4 hours agoAmerica First in Action, All the Latest News | TRIGGERED Ep.278
124K112 -
1:02:48
BonginoReport
5 hours agoChristianity Is Under Attack - Nightly Scroll w/ Hayley Caronia (Ep.144)
70.5K63 -
LIVE
JdaDelete
3 hours ago $0.36 earnedHollow Knight: Silksong - Steel Soul [Permadeath]
71 watching