This question already has an answer here:
- How do I test one variable against multiple values? 8 answers
- Why does `a == b or c or d` always evaluate to True? [duplicate] 1 answer
So I am trying to write a python script that will help me keep my evenings busy, it contains some exercises and other activities.
Basically the script finds out what date it is e.g. "07" is the 7th of any month. I only have activities for 28 days at the moment, which is fine with me.
The problem is no matter what date it is I always get the last if statement, regardless of the actual day.
import os
import datetime
import time
day = (time.strftime("%d"))
day = str(day)
print(day)
if day == "01" or "08" or "15" or "22":
a_1 = "Bicep_workout"
if day == "02" or "05" or "09" or "12" or "16" or "19" or "23" or "26":
a_1 = "Bike"
if day == "03" or "07" or "11" or "17" or "21" or "25" or "28":
a_1 = "Back"
elif day == "04" or "10" or "18" or "24":
a_1 = "Shoulder"
elif day == "14":
a_1 = "Umedy"
else:
print("Error")
if day == "01" or "08" or "15" or "22":
a_2 = "Triceps_workout"
elif day == "02" or "09" or "16" or "23":
a_2 = "Core_exercise"
elif day == "07" or "21" or "13" or "27":
a_2 = "Book"
elif day == "14" or "28":
a_2 = "Umedy_2"
else:
print("Error")
print(a_1 + " " + a_2)
Any and all help would be greatly appreciated
Thanks :)
Aucun commentaire:
Enregistrer un commentaire