Ask coding questions

← Back to all posts
Please find the error
ShivamGupta37 (0)

This code is to find the input as weekend or week day but when we give the input as a weekday(say tuesday), the output comes Weekend. Please find the error in this code

Comments
hotnewtop
RYANTADIPARTHI (6017)

Solution

in python, you have to rename what you're trying to check when using or. you need to change your if statement.

day = input("Enter the day: ")
if day == "Sunday" or day == "Saturday":
    print("Weekend")
else:
    print("Weekday")

like that.
That should work.

malvoliothegood (871)

You if needs some work. Try this:

day = input("Enter the day: ")
if day == "Sunday" or day == "Saturday":
    print("Weekend")
else:
    print("Weekday")