+ 2

Why this code is not working?

This python program to convert celsius to Fahrenheit and Fahrenheit to celsius is working on my desktop or any other device having python interpreter but why it is not working on sololearn's code playground? https://code.sololearn.com/cYn7cSjs4SOe/?ref=app

13th Sep 2020, 2:56 PM
Aditya Raut
3 Answers
+ 2
It's working fine ,just that sololearn takes all inputs at the first time only ,and since you aren't providing anyway to exit while loop ,it keeps asking C or F Also you need to provide inputs like this C 100
13th Sep 2020, 3:04 PM
Abhay
Abhay - avatar
+ 2
You have to avoid input in code playground .I have a try with your code take a look here . https://code.sololearn.com/c3CXZO3O2g2J/?ref=app
13th Sep 2020, 3:16 PM
HBhZ_C
HBhZ_C - avatar
0
def celsius(): value = int(input("Enter the number to convert into celcius: ")) value_returned = ((value-32)*5)/9 print(str(value_returned) + " C \n") def farhen(): value = int(input("Enter the number to convert into Farhen: ")) value_returned = value/5*9+32 print(str(value_returned) + " F \n") while True: n = str(input("Select C or F: ")) if n == "C": celsius() elif n =="F": farhen() else: break "" input F #press enter 45 C 55 X #press submit #note SoloLearn require all input at once at beginning.. #run this code to know that better way : https://code.sololearn.com/WhiNb9BkJUVC/?ref=app ""
13th Sep 2020, 4:07 PM
Jayakrishna 🇼🇳