Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
If Statement
#9
on line 9 it's better to have elif, not if.
The way you have it now will print 2 sentences if age < 18 and country not in ['Britain', 'UK'] - not able to vote because of age and not able to vote because of country

As a side note to both you and @pyzyx3qwerty - this very much looks like homework and that is why I just provided guidance to OP, i.e. I didn't want to give away ready solution. Anyway you did :-)
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
If Statement - by Bobcat - May-02-2020, 03:28 PM
RE: If Statement - by buran - May-02-2020, 03:36 PM
RE: If Statement - by pyzyx3qwerty - May-02-2020, 03:55 PM
RE: If Statement - by buran - May-02-2020, 04:01 PM
RE: If Statement - by buran - May-02-2020, 04:03 PM
RE: If Statement - by menator01 - May-02-2020, 07:24 PM
RE: If Statement - by buran - May-02-2020, 07:27 PM
RE: If Statement - by menator01 - May-02-2020, 07:47 PM
RE: If Statement - by buran - May-02-2020, 07:57 PM
RE: If Statement - by pyzyx3qwerty - May-03-2020, 04:57 AM
RE: If Statement - by menator01 - May-02-2020, 08:00 PM
RE: If Statement - by buran - May-02-2020, 08:14 PM
RE: If Statement - by ndc85430 - May-03-2020, 05:00 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020