私はPythonを初めて使い、基本を学んでいます。あなたは私のためにこれを修正して、どうやって私が間違っていたのか教えてください。 PythonでTypeError:intではなくstrでなければなりません(基本ユーザ)
age = input('Please enter your age:')
ten = 10
agePlusTen= age + ten
print('You will be', agePlusTen, 'in 10 years'
Traceback (most recent call last):
File "C:/Users/Admin/Documents/Python/6.2 fixed.py", line 3, in <module>
print('You will be', age + ten, 'in 10 years')
TypeError: must be str, not int
'input'は文字列を返します。数学をする前に 'int'を適用してください。 –
これはメガ・ドゥープですが、私は似たような質問をatmと考えることはできません。 –
なぜあなたはそのようなvarを作るのですか? –