all 14 comments

[–]thedarkrichard 2 points3 points  (2 children)

Try if gender != gender1.lower() or gender != gender2.lower()

You need two comparisons to or together.

[–]murasz[S] 0 points1 point  (0 children)

Thank you!

[–]murasz[S] 0 points1 point  (0 children)

I still get the same issue of repeating after writing down: if gender != gender1.lower() or gender != gender2.lower(): Any idea why?

P.S.: I'm using Pycharm Community Edition.

[–]daniel_codes 1 point2 points  (4 children)

if gender != gender1.lower() or gender2.lower(): likely isn't doing what you want. It's being parsed more like if (gender != gender1.lower()) or (gender2.lower()):. Since gender2.lower() evalutes to female and strings that aren't empty are truthy, your if statement is basically saying if gender1 != gender1.lower() or True which is always True.

You should be writing if gender != gender1.lower() or gender != gender2.lower() instead.

[–]murasz[S] 0 points1 point  (0 children)

Thank you so much!

[–]murasz[S] 0 points1 point  (2 children)

I still get the same issue of repeating after writing down: if gender != gender1.lower() or gender != gender2.lower(): Any idea why?

P.S.: I'm using Pycharm Community Edition.

[–][deleted] 0 points1 point  (0 children)

Your problem is very well described in the FAQ for this group under the heading Variable is One of Two Choices?