Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6
According to your first condition, a child is a person that is older than 0 and older than 11. What if the user enters 6? Wouldn't a 6 year old person be a child as well?
20th Jan 2023, 1:27 PM
Lisa
Lisa - avatar
+ 1
In if-statement there's no range of numbers bigger or equal to 0 and bigger or equal to 11. Example: You enter 6 as input. Not both conditions are true in if-statement: indeed age >= 0 is true but age >= 11 is false. The output is not "Child". One more thing, if your input is bigger than 11, it always prints "Child". I may be wrong with it.
20th Jan 2023, 7:17 PM
tnaa
tnaa - avatar