0
a = ('''
Escolha a conversão que você deseja realizar:
1) Celcius-Fahrenheit
2) Fareheint-Celcius
3) Celcius-Kelvin
4) Kelvin-Celcius
5) Fahrenheit-Kelvin
6) Kelvin-Fahrenheit
''')
try :
a = int(input(a)) and (a) < 7 and (a) > 0
except ValueError:
print ("Escolha uma opção válida")
I’m trying to make a program that converts one temperature from one scale to another.
But every time I try to run the two main exceptions of the program (do not run letter as an option and have a value of 1 to 6 for the user to choose). Is giving this error in VSC :
Typeerror: '<' not supported between instances of 'str' and 'int'*.
I would like to know why this and how to make the program work with these two exceptions
You cannot compare Stings with integers
(a) < 7
and(a) > 0
– Augusto Vasques
Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful to you. You can also vote on any question or answer you find useful on the entire site
– Maniero