从输入语句打印提示?

2024-09-27 21:25:20 发布

您现在位置:Python中文网/ 问答频道 /正文

我在使用dcoder时遇到问题。我的意见是: 20 50 8 30至10

它不仅输出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)

Tags: inputvalue语句resultiteminttotalweight

热门问题