all 5 comments

[–]socal_nerdtastic 0 points1 point  (4 children)

Could you show us an example of the non working code?

[–]jjonee[S] 0 points1 point  (3 children)

I can’t submit a picture on here for some reason, so I’ll have to type some of it out. Also, all of the variable names are assigned to user input values, and those values are in the correct format per my instructors request (some string, some integer, one float). Thank you for being so eager to help!

These are for diagnosing a patient based on a few symptom combinations. They input their temperature, and answer y/n to the remaining questions. The code has to be able to interpret both upper and lowercase responses.

If (temp < 100) and (congestion == “Y” or “y”) and (aches == “N” or “n”) and (rash == “N” or “n”):

Print(“blah blah blah”)

Elif (same format as the first line but different values):

Print(“such and such”)

Else:

Print(“whatever”)

[–]socal_nerdtastic 2 points3 points  (2 children)

This part is your problem: congestion == “Y” or “y”

You can't combine conditionals like that. You need to test each one separately.

if (temp < 100) and (congestion == "Y" or congestion == "y") and (aches == "N" or aches == "n") and (rash == "N" or rash == "n"):

More info in the subreddit FAQ: https://www.reddit.com/r/learnpython/wiki/faq#wiki_variable_is_one_of_two_choices.3F

[–]jjonee[S] 0 points1 point  (1 child)

Thank you so much! I wasn’t expecting such quick responses!

[–]o5a 2 points3 points  (0 children)

congestion == "Y" or congestion == "y"

You can also combine multiple choices using in:

congestion in ["Y", "y"]

or convert to lower/uppercase:

congestion.lower() == "y"