Em có đoạn code:
age = raw_input("How old are you? "),
height, tall = input("How tall are you? "),
weight = raw_input("How much do you weight? ")
print "So, you're %r old, %r tall and %r heavy." % (age, tall, weight)
lỗi:
How old are you? 18
How tall are you? 170
Traceback (most recent call last):
File "/home/vuonglv/python/ex12/ex12.py", line 2, in <module>
height, tall = raw_input("How tall are you? "),
ValueError: need more than 1 value to unpack
Em thử nhập 2 lần
How old are you? 18
How tall are you? 170 170
Traceback (most recent call last):
File "/home/vuonglv/python/ex12/ex12.py", line 2, in <module>
height, tall = raw_input("How tall are you? "),
ValueError: need more than 1 value to unpack
Em muốn lấy dữ liệu cho 2 biến height và tall trong một lần gọi hàm raw_input() nhưng có vẻ không được.
Em đã thử việc truyền 2 tham số khi nhập ở Terminal, em hiểu là raw_input() này nó get dữ liệu vào dạng str, thì làm sao để mình lấy được 2 biến như trên ạ?
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?