0

How do I make the celsius variable accept several values ​​such as 5,12,45 and not give me any error when doing it

celsius = 18 fahrenheit = 9/5 * celsius + 32 print (fahrenheit)

31st Dec 2020, 8:05 PM
Astrid
Astrid - avatar
10 ответов
+ 1
I think I understand, does something like below help? https://code.sololearn.com/cMw7s7a8ba5V/?ref=app
31st Dec 2020, 8:27 PM
Steven M
Steven M - avatar
+ 3
Astrid if you mean you have several numbers to enter and you want answers for each... here is an unlimited way ... You start with entering how many numbers you are checking then enter them line by line hit enter # All results displayed https://code.sololearn.com/ceT7291sap36/?ref=app
31st Dec 2020, 8:30 PM
BroFar
BroFar - avatar
+ 2
Exactly what you want to do? Can you give an example of how those values will work with celsius or in your code.
31st Dec 2020, 8:14 PM
Abhay
Abhay - avatar
+ 1
Can you elaborate on what you mean by accepting "5,12,45"? Do you want user input? Like : celsius=int(input ()) .
31st Dec 2020, 8:08 PM
Abhay
Abhay - avatar
+ 1
I get an error when I add several numbers, but I think I already know where I am wrong, thanks
31st Dec 2020, 8:16 PM
Astrid
Astrid - avatar
+ 1
Thanks BroFar
31st Dec 2020, 8:34 PM
Astrid
Astrid - avatar
+ 1
Thanks Steven M
31st Dec 2020, 8:35 PM
Astrid
Astrid - avatar
+ 1
def converter(celsius) : fahrenheit = (9/5)*(celsius+32) print(fahrenheit) try: celsius=input('enter the value in celsius') cel=int(celsius) converter(cel) except: print('enter intger value')
2nd Jan 2021, 6:02 PM
Mohammad Issa
Mohammad Issa - avatar
0
hello is like entering the number and keeping it and entering another number does not delete the previous one, it is possible without using the input or you have to use the conditional or sequential structures to do it. Thank you
31st Dec 2020, 8:11 PM
Astrid
Astrid - avatar