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)
10 Réponses
+ 1
I think I understand, does something like below help?
https://code.sololearn.com/cMw7s7a8ba5V/?ref=app
+ 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
+ 2
Exactly what you want to do? Can you give an example of how those values will work with celsius or in your code.
+ 1
Can you elaborate on what you mean by accepting "5,12,45"?
Do you want user input?
Like : celsius=int(input ()) .
+ 1
I get an error when I add several numbers, but I think I already know where I am wrong, thanks
+ 1
Thanks BroFar
+ 1
Thanks Steven M
+ 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')
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