So I'm writing a little bit of code as a fun project that will randomly generate a subject for me to study each day. But once a subject has appeared once I don't want it to appear for the rest of the week. To do this I'm using a list. Basically, when it picks the subject it adds it to the list and the next time it checks to see if it's already on the list, and if so, I want it to return to the random number generator. How do I do this? Here's my code.
import random
import time
import datetime
#Subject veto list
x=[]
# Messages to instil, um, enthusiasm.
if datetime.date.today().strftime("%A") == "Monday":
response = input("Here we go again. Are you ready? ")
elif datetime.date.today().strftime("%A") == "Tuesday" or "Wednesday" or "Thursday":
response = input("Are you ready? ")
elif datetime.date.today().strftime("%A") == "Friday":
response = input("Half day! Are you ready? ")
elif datetime.date.today().strftime("%A") == "Saturday" or "Sunday":
response = input("It's the weekend! Are you ready? ")
# Random picking of subject to study. Also adds sbject to veto list for rest of week.
if response == "Yes":
subject = random.randint(1, 7)
print("Today you are studying...")
time.sleep(3)
if subject == (1):
"Englsh" in x
print("English")
x.extend([English])
elif subject == (2):
"Irish" in x
print("Irish")
x.extend([Irish])
elif subject == (3):
"Maths" in x
print("Maths")
x.extend([Maths])
elif subject == (4):
"French" in x
print("French")
x.extend([French])
elif subject == (5):
"Physics" in x
print("Physics")
x.extend([Physics])
elif subject == (6):
"Chemistry" in x
print("Chemistry")
x.extend([Chemistry])
elif subject == (7):
"History" in x
print("History")
x.extend([History])