Ich versuche, einen Abschlussrechner von Fahrenheit nach Celsius zu machenPython

Python-Programme
Anonymous
 Ich versuche, einen Abschlussrechner von Fahrenheit nach Celsius zu machen

Post by Anonymous »

Ich erhalte immer wieder diesen Fehler: < /p>

Code: Select all

"TypeError: can only concatenate str (not "int") to str"
< /code>
import math
temp_input = input(
'Insert the temperature you would like to convert(100F , 35C for example):')
unit = temp_input[-1].lower()
number = temp_input[:-1]

F_temp = ((( 9 *(number)) + 160) // 5)
C_temp = (((5 * (number)) - 160) // 9)

if temp_input[-1:] == 'f':
print(C_temp)
elif temp_input[-1:] == 'c':
print(F_temp)
else:
print('try to add C / F , after the numbers !')

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post