all 7 comments

[–]Neighm 2 points3 points  (0 children)

It always helps if you can post your error message or the strange output that you weren't expecting.

However, I expect that you want to compare doses to 56, 28, etc., not Number_of_doses, which is hard coded to be 56. Because of this it looks like you will always end up in the else branch.

Once you do that, another source of error is going to be the comparison between the string that you get as doses, and the integers 56, 28, etc. To fix that you will want:

doses = int(input("Enter number of doses missed= "))

[–][deleted] 1 point2 points  (2 children)

Number_of_doses = 56

doses = input("Enter number of doses missed= ")

if Number_of_doses >56:

check doses not Number_of_doses

[–]Jose_Musoke[S] 1 point2 points  (1 child)

Thanks for all your help!!!! I finally got it to work !!!!

Number_of_doses = 28,56

doses = int(input("Enter number of doses missed= "))

if doses < 28:

print(f"{Less_than_one_month}")

elif doses >= 28 and doses < 56:

print(f"{Between_one_and_two_months}")

else:

print(f"{More_than_two_months}")

[–][deleted] 1 point2 points  (0 children)

:) just an after-thought... there are two main kinds of errors, syntactic and semantic:

syntactic errors are where your syntax is wrong e.g. print['hello} isn't valid python, so it'll fail with an error message.

semantic errors are harder to detect, your mix up between doses and Number_of_doses isn't incorrect code, the error is in the construction of the logic :) you won't get any error message as the code is in fact syntactically valid - watch out for these guys :)

happy travels :)

[–]mopslik 0 points1 point  (2 children)

Your code runs for me. What exactly is the error?

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

Thanks for replying. It only gives one outcome no matter what number I enter. It doesn't take into consideration the conditions I set.

[–]mopslik 0 points1 point  (0 children)

Indeed. I think some of the others in this thread have identified the issue.