首页 > 解决方案 > 从输入语句打印提示?

问题描述

我在使用 dcoder 时遇到问题。我的输入是: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)

标签: python

解决方案


推荐阅读