因此,我想制作一个采用用户输入的不和谐python机器人。我想做的是数某事。这是我想做的imgur链接:https://imgur.com/a/ZreLAVR
我在Discord机器人上开始之前已经编写了此代码。但是idk如何获取用户输入。
userInputOriginalPrice = float(input("Enter the original price: "))
userInputPercentage = float(input("Enter how much percantage: "))
discount = ( userInputPercentage / 100) * userInputOriginalPrice
finalCost = userInputOriginalPrice - discount
print("You saved", discount, ". Your total is", finalCost)
问题尚不清楚,您的代码正在按您希望的方式运行。我对代码进行了一些细化,以使输出更具表现力。试试这个:
userInputOriginalPrice = float(input("Enter the original price: "))
userInputPercentage = float(input("Enter how much percantage: "))
discount = ( userInputPercentage / 100) * userInputOriginalPrice
finalCost = userInputOriginalPrice - discount
print('You saved $' + str(discount) + ', Your total is $' + str(finalCost))