Is there a way I can store all of the return values from a function from each time I call it? Here is the code:
def workdaystart(dayoftheweek):
starthour=input("What is your START HOUR for "+ dayoftheweek+"? ")
print("Is that AM or PM")#Allows us to differentiate between time periods#
print ("1. AM")
print ("2. PM")
print("3.I DONT WORK")
starthoursuffix = int(input('Enter your choice [1-2] : '))
if starthoursuffix == 1:
starthour=starthour+"AM"
elif starthoursuffix==2:
starthour=starthour+"PM"
else:
starthour=" "
return starthour
daysofweek=
["monday","tuesday","wednesday","thursday","friday","saturday","sunday"]
for day in daysofweek:
x=workdaystart(day)
As you can see it runs the items in the list in the function but I then want the start hour of that day to be stored as a variable outside of the funtion.
x=workdaystart(day)does, it stores the start hour in the variablex.xwould be the value of Sunday's. Create a dictionary with the days as the keys and the start hours as values