It does the subtraction, but not the floor decision and adding
import discord
from discord.ext import commands
bot = discord.ext.commands.Bot(command_prefix = "$")
@bot.event
async def on_message(message):
if 0 < int(message.content) < 153:
await message.channel.send("you are in Bronze 1. You are {} games away from Bronze 2".format(153 - int(message.content)//7 +1))
if 153 < int(message.content) < 200:
await message.channel.send("you are in Bronze 2")
Since you didn't use a bracket, the order where 153 - int(message.content)//7 +1)
is ordered the same as 153 - (int(message.content)//7) + 1
as multiplication/division comes before addition/subtraction. Judging from the math I'm guessing that's not what you wanted.
Also some side notes:
int(message)
is 153 the input is completely ignoredelif
for the second block since it's non-overlapping.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.