#๐ Age between script
63 messages ยท Page 1 of 1 (latest)
@misty ferry
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.
Your comparing int to a string
I just realised
๐ญ
i accidentally deleted it so if other people are interested in my problem
can you repost
so if age == 0, the person is not a child?
Well if your age is 0 without any seconds of existence you technically don't exist
Literally Korea
what is it
using the following ages, 0 - 12 - 13 - 18 - 19 do not give me a print command
how would i fix this?
We don't understand. If the ages are 0 or 12 or 13 or 18 or 19, don't print anything?
are you supposed to be using "" ? those are used for strings no?
Aren't they not supposed to print (according to the if statement in the image)?
Let me send my script
thanks
And also, make sure you're checking it with an int. if age > 0 etc.
Not supposed to print?
``age = int(input("Age: "))
if age >= 0 and age <=12:
print("Child is what you are")``
You don't need the .strip() btw
It is printing
prints for me
huh
using this
Your if statements specifically ignore those.
Can you show how you're testing it?
0, 12, 13, 18 and 19 all fail to pass the if statements.
use the <= >=
You might want to consider using <= or >=
oh
Those check if it's less than or equal to and if it's greater than or equal to, respectively.
oh
ohh okay
i understand now
ty
Using < or > is strictly less than and strictly greater than, so those few numbers wouldn't pass any of the statements.
!e p.s you can chain comparisions to make it more readable like so
age = 8
print(0 <= age <= 12)
:white_check_mark: Your 3.12 eval job has completed with return code 0.
True
oh okay so it ignores the number i input
you could just check age <= 12
and skip the lower bound check
if someone enters a negative age, the joke's on them
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.