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))
-
3:45
Blackstone Griddles
4 hours agoSimple Smashburgers with Burger Sauce on the Blackstone Griddle
2081 -
LIVE
EricJohnPizzaArtist
6 days agoAwesome Sauce PIZZA ART LIVE Ep. #54: I WANT MY PUDGE TV!
224 watching -
15:45
The Car Guy Online
4 hours agoGM’s ‘Own Nothing, Be Happy’ Plan! Former Engineer Blows Whistle.
30 -
LIVE
SpartakusLIVE
1 hour agoLAST CHANCE for Spartakus' Loadouts w/ ADVANCEDgg || 25% off! - Code "Spartakus"
87 watching -
8:48
Millionaire Mentor
7 hours agoBrandon Gill DESTROYS Kaitlan’s TRAP Question in One BRUTAL Sentence
471 -
1:07:49
Jeff Ahern
5 hours ago $11.48 earnedThe Sunday Show with Jeff Ahern
31.7K21 -
LIVE
Spartan
1 hour agoPro Halo Player | Ranked
54 watching -
1:10
Damon Imani
4 hours agoAna Navarro Said Trump Wants To Make America WHITE Again - Got Dismantled by Damon!
2181 -
LIVE
Joker Effect
56 minutes ago🚨MASSIVE ANNOUNCEMENT🚨- Changes coming! Massive Rumble Twitter Space Tomorrow! PUBG GAMEPLAY! ECT
486 watching -
9:36
MattMorseTV
5 hours ago $0.76 earnedThe EU just FOUND OUT.
1.62K10