0

Function question

I was told to add an additional function to a code which ’activates’ if they user types in zero.In that case a random number will be generated and tested.. The code is about an american who wants to enter a european sauna where they use celcius instead of fahrentheit. Errors are taken care of and the loop is also working but my concern is wether i have written the code right, specially in get_fahr() part. Please check and see if it correct: https://code.sololearn.com/cDeGq59aPu9L/?ref=app

18th Feb 2022, 12:27 PM
Lenoname
5 odpowiedzi
+ 1
What do mean by activate? Why you trying to call 2 times zeroIn() ? No effect of first one.
18th Feb 2022, 1:29 PM
Jayakrishna 🇮🇳
+ 1
Is it correct or not is depends on your requirement. Try all kind of inputs It's taking input. Raising error on wrong input. And asks again input, until you get return value not none or between 82 and 87 But only you are checking this redundant. Just call once. while f is None or (not (82 <= f <= 87)): print("Wrong input") f = get_fahr()
18th Feb 2022, 1:56 PM
Jayakrishna 🇮🇳
0
wheres the question for the code
18th Feb 2022, 12:59 PM
Ion Kare
Ion Kare - avatar
0
Jayakrishna🇮🇳 If the user types 0 then this (zeroIn) function will start working,the first time is to call the function, the second time to make the temperature equal to the value of zeroIn function.(maybe, i dont know)
18th Feb 2022, 1:38 PM
Lenoname