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
BubbaMatt
10 hours agoMafia Definitive Edition Playthrough - Part 5
181 watching -
51:25
Donald Trump Jr.
2 hours agoAmerica First in Action, All the Latest News | TRIGGERED Ep.278
94.1K94 -
1:02:48
BonginoReport
4 hours agoChristianity Is Under Attack - Nightly Scroll w/ Hayley Caronia (Ep.144)
39.1K42 -
LIVE
JdaDelete
1 hour agoHollow Knight: Silksong - Steel Soul [Permadeath]
36 watching -
LIVE
FLRG
1 hour agoFLRG LIVE ROAD TO 2015 FOLLOWERS
4 watching -
1:05:10
The Nick DiPaolo Show Channel
4 hours agoKirk Assassination Theories Abound! | The Nick Di Paolo Show #1795
27.4K27 -
LIVE
Focus_Up
47 minutes agoGrinding resurgence ranked!! Playing with Subscribers!! Lets have some fun!!!
253 watching -
LIVE
Chrono
1 hour agoSplat-Tasks 2 - Splatoon but with more Rules
252 watching -
41:09
Katie Miller Pod
17 hours ago $0.95 earnedEpisode 8 - Adena Friedman | The Katie Miller Podcast
16.8K -
GritsGG
6 hours agoDuos! Most Wins in WORLD! 3680+!
10.6K