<分区> 分区>
不明白为什么我会收到 TypeError: 'int' object is not iterable
first_age = int(input("Enter your age: "))
second_age = int(input("Enter your age: "))
total = sum(first_age, second_age)
print("Together you're {} years old".format(total))
Enter your age: 1
Enter your age: 1
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-25-6375ca82c6eb> in <module>
4 second_age = int(input("Enter your age: "))
5
----> 6 total = sum(first_age, second_age)
7
8 print("Together you're {} years old".format(total))
TypeError: 'int' object is not iterable
TypeError Traceback (most recent call last)
<ipython-input-25-6375ca82c6eb> in <module>
4 second_age = int(input("Enter your age: "))
5
----> 6 total = sum(first_age, second_age)
7
8 print("Together you're {} years old".format(total))
TypeError: 'int' object is not iterable
