#๐ Password and user
28 messages ยท Page 1 of 1 (latest)
@green bone
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
damn idk what the bot command is
python uses indentation to determine how the code is supposed to run
What's indention
if a == 5:
print('wow')
else:
print('a is not 5 :(')
you can see the print statements have an extra tab (i.e. an extra indentation level) compared to the if/else parts
that tells python that they go inside the if/else branches
Yeah, that's how you make it connected, by putting the spaces on everything that you only want to run if the condition is true. In your case, that's the print("Correct")
Additionally, something you confused is the equality syntax
Instead of if Password: (13131), you want if Password == 13131:
Finally, this code probably won't work how you want it to, because you aren't getting any user input. Do you know how to do that?
@green bone ^
||py password = int(input("Try a password: ")) if password == 13131: print("Correct") else: print("Incorrect")||
This is what a working code could look like, if you want it for reference
Thanks so much
Sorry but how can I make a user too
The same way, ask for an input, check if it's the one you want and only let them keep going if that happens
Try it out, if you need help, feel free to ask
I'm not sure I'll be able to respond, but someone surely will
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.