Ich versuche, einen Abschlussrechner von Fahrenheit nach Celsius zu machen

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Ich versuche, einen Abschlussrechner von Fahrenheit nach Celsius zu machen

by Anonymous » 12 Apr 2025, 19:15

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 !')

Top