How could I fix this line

Hi @caisright11 I think I see the error on line 15. At the end of the line you close the brackets. This isn’t what you should do before then formatting client. It should be something like

print('we have logged in as {0.user}'.format(client))
1 Like

Hi again. Jumping in to the next problem. @not-ethan is right there is an indent on line 18 that isn’t meant to be there. It should line up with the @ above on line 17.

@client.event()
async def on_message(message):

Another problem is that you haven’t put any instruction after the selection statement (IF) on line 19. If you don’t want it to do anything at the moment try this:

if message.author == 989262777015205940:
   pass
return

It says return outside function

Hi @caisright11 . Are you sure you are indenting the python code correctly? the IF and RETURN should be tabbed in one place more than the ASYNC DEF line.

Hi @CosmicBear welcome to the Discourse!

To be fair a lot of my students (and sometimes fellow teachers) sometimes find it difficult to find errors in their own code. It might just be that @caisright11 needs a second pair of eyes to spot the indent issue. I hope that our replies have helped and that, in return, @caisright11 will be kind enough to help others in a similar situation in future.

Which websites did you use to learn Python @CosmicBear ? It would be great to share with the community.

Thanks for posting!

Honestly @CosmicBear, How am I supposed to get better if I don’t challenge myself? You are contradicting yourself? What I am currently trying to fix is my challenge. In order to grow you must challenge yourself. Seriously how am I supposed to get better without trying harder things.

Argue with me all you want, you can’t deny that you started python or some other coding language and as you got better you did harder things.

Finally, This is my way of challenging myself and getting better.

Thanks for reading my post, caisright11

not related, but this does the exact same thing as line 3, but much simpler:

print(f"We have logged in as {client.user}")

f-string

1 Like