#๐Ÿ”’ issues with an if statement

17 messages ยท Page 1 of 1 (latest)

cerulean wyvern
#

hello, i am having some issues with this if statement and was wondering if anyone would help me out, heres what i want the code to do and whats not working

  1. ask "how many games is the pennant you are playing?", the answer will either be 10 or 20. (this part works just fine)
  2. put that number in the For i in range, parentheses and loop that many times (this may or may not work, i havent gotten that far yet)
  3. if a 10 is input, execute the first set of code, if a 20 is input, execute the second.
wise gullBOT
#

@cerulean wyvern

Python help channel opened

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.

cerulean wyvern
#

i dont understand everything about coding so if you dont understand something its probably my fault

vague rock
#

You used int to make game_number an integer, but in the if conditions, you're comparing that integer to a string ("10"), and an integer will never equal a string.

cerulean wyvern
#

so i need the IF conditions to look for an integer?

vague rock
#

Yes.

cerulean wyvern
#

how might i do that?

vague rock
#

Well, "10" is a string, 10 is an integer.

#

The quotes indicate that it's text

cerulean wyvern
#

so just remove the quotes?

vague rock
#

Yes

cerulean wyvern
#

Thank you

vague rock
#

You're welcome. Do you understand what the problem was?

cerulean wyvern
#

yes, I was giving it a string instead of a integer

vague rock
#

Yep

wise gullBOT
#
Python help channel closed

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.