Answer the question
In order to leave comments, you need to log in
Why does cost not change?
dear pythonists, could you help?
sorry for the shitty code, but why doesn't my cost change?
lvl = await get_lvl(message)
if int(lvl) >= int(1):
cost = 5000
elif int(lvl) >= int(10):
cost= 10000
elif int(lvl) >= int(20):
cost= 50000
elif int(lvl) >= int(30):
cost= 100000
elif int(lvl) >= int(40):
cost= 250000
elif int(lvl) >= int(50):
cost= 500000
elif int(lvl) >= int(60):
cost= 750000
elif int(lvl) >= int(70):
cost= 1000000
elif int(lvl) >= int(80):
cost= 1500000
elif int(lvl) >= int(90):
cost= 2000000
elif int(lvl) >= int(100):
cost= 5000000
snyato = int(return_get_balance) - int(cost)
Answer the question
In order to leave comments, you need to log in
int(lvl) >= int(1)
11 - always greater than one It is
necessary to check the occurrence in the range
lvl = int(await get_lvl(message))
if 0 <= lvl <= 9:
cost = 5000
elif 10 <= lvl <= 19:
cost = 10000
...
lvl = 23
costs = {
10: 5000,
20: 10000,
}
rounded_lvl = (lvl // 10) * 10
print(f'Rounded level: {rounded_lvl}')
cost = costs.get(rounded_lvl)
print(f'Cost: {cost}')
Rounded level: 20
Cost: 10000
Process finished with exit code 0
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question