从输入语句打印提示?

时间:2018-10-06 00:33:17

标签: python

我在使用编码器时遇到问题。我的输入是: 20 50 8 30 10

它不仅输出80,而且还输入语句的提示。如何仅打印80张纸?

maxw =  int(input("bag weight: "))
itemOne = input("item value & weight:") #item 1 
itemTwo = input("item value & weight:") #item 2
lone, ltwo = itemOne[0:3], itemTwo[0:3]  #rid of " "
iione, iitwo = int(lone), int(ltwo) #change to int

def total_value(x, y):
    tval = x + y             #add together 50 and 80
    return tval

result = total_value(iione, iitwo)
print(result)
![enter image description here](https://i.stack.imgur.com/f8Jh4.png)![enter image description here](https://i.stack.imgur.com/zCAcC.png)

0 个答案:

没有答案