Lỗi ở bài tập 14 LPTHW: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

age = input("How old are you? ")
height = input("How tall are you? ")
weight = input("How much do you weight? ")

print ("So, you're %r old, %r tall and %r heavy.") %(age, height, weight)

Thông báo lỗi:

How old are you? 23

How tall are you? 167

How much do you weight? 72

So, you're %d old, %d tall and %d heavy.

Traceback (most recent call last):

File "ex12.py", line 5, in <module>

print ("So, you're %d old, %d tall and %d heavy.") %(age, height, weight)

TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

Mình đã thử rất nhiều cách nhưng không sữa được lối này, mong mọi người giúp đỡ.
P/S: Mình code trên macos với phiên bản python 3.7.3

vị trí dấu ngoặc

print (“So, you’re %r old, %r tall and %r heavy.”) %(age, height, weight)
                                                 ^---------------------->^
                                  bạn đóng ngoặc ở đây          nhưng nó cần ở đây
  • báo lỗi trong python dở ẹc
2 Likes
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?