Why my outputs are printing double and in the middle of my output there's an little error but still printing outout,why? | SoloLearn: Learn to code for FREE!

0

Why my outputs are printing double and in the middle of my output there's an little error but still printing outout,why?

while True: print("Select the categories:\n") converter=input("\t1.Celsius to Fahrenhiet\n\t2.Celsius to Kelvin\n\t3.Fahrenhiet to Celsius\n\t4.Fahrenhiet to Kelvin\n\t5.Kelvin to Celsius\n\t6.Kelvin to Fahrenhiet\n\t7.'quit' to end the program\n") if converter =='7': print("You wished to End") if converter in ('1','2','3','4','5','6'): temp=float(input("Enter the temperature:\n")) if converter =='1': result=((9*temp)+160) print("Celsius to Fahrenhiet="+str(result)) elif converter =='2': result = (temp+273) print("Celsius to Kelvin="+str(result)) elif converter =='3': result =((5*temp)-160)/9 print("Fahrenhiet to Celsius="+str(result)) elif converter =='4': result =((5*temp)+2297)/9 print("Fahrenhiet to Kelvin="+str(result)) elif converter =='5': result =(temp-273) print("Kelvin to Celsius="+str(result))

5/15/2020 4:54:43 AM

Tanjir Ahmed

5 Answers

New Answer

+2

Becoz it is a infinity loop Try out this 👇👇👇👇👇 https://code.sololearn.com/cX2313xvHm5A/?ref=app

+1

Divison by default produce floating point result, explicitly convert to int if you need integer output. If the option is 7 then after printing the statement you need a break statement to come out of the loop. No code for option 6?

0

Abhay tnx man..can plz explain a little behind the reason...I have never seen or thought something like that.

0

Simple Sololearn compliler is not sufficient for multiple input and in fir while loop it ask for multiple input even after showing ur result Ur code is perfect Try to run it on pydroid Download pydroid for Play store Stay home Stay safe

0

Abhay Thank you so much