F
F
flurix2020-07-21 16:11:39
Python
flurix, 2020-07-21 16:11:39

SyntaxError: invalid syntax?

I wanted to make a game "heads or tails" in a discord bot.
Here is the code itself:


@bot.command()
async def game(ctx):
  game_random = random.randint(1, 3),
  if game_random = 1:
    await channel.send(embed = discord.Embed(description = 'Выпала решка!', color = 0xFF8C00))
  elif game_random = 2:
    await channel.send(embed = discord.Embed(description = 'Выпал орёл!', color = 0xFF8C00))
  else:
    await channel.send(embed = discord.Embed(description = 'Монета встала ребром!', color = 0xFF8C00))


Error when trying to run:
if game_random = '1':
^
SyntaxError: invalid syntax

Answer the question

In order to leave comments, you need to log in

1 answer(s)
_
_, 2020-07-21
@flurix

Remove the comma after AND in comparisons, replace = with == game_random = random.randint(1, 3)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question