【发布时间】:2022-12-01 22:17:46
【问题描述】:
I'm Trying to make a tax calculator but it's returning something strange.. Here's the function:
async def tax(args):
args3 = 5
protax= round(int(args)*args3/100)
if protax == 0:
protax = 1
return protax
here is where I call the function:
c.execute("SELECT price FROM netflix ")
netfprice = c.fetchall()
netprice = netfprice[0][0]
newnet = netprice*amount
withtax = await tax(args=newnet)
embed = discord.Embed(
title="tax system",
description=f"tax:{netprice + withtax}")
embed.set_footer(text=f"Sidtho Host. | Requested by - {message.author}")
await message.respond(embed=embed)
For this example let's use amount = 2, netprice = 3999.
It returned 4199, but should've returned 7998 + 400, So 8398.
【问题讨论】:
-
Did you post all of the relevant code? With your example values, the function should've returned
400. -
No I didn't wait let me edit the code. Sorry, By the way: I did make it send netprice + withtax
-
Since you print
netprice + withtax, again, it should have printed4399(neither4199, nor8398). Which output do you expect to be 8398? What function returns, or what you have indescriptionsting? -
Yeah true it was 4399 Sorry for my mistakes. I expected
descriptionto return 8398, and the tax func to calculate -
Okay I feel really dumb after seeing my mistake ... I found it
标签: python discord.py pycord