I have a loop that creates a dictionary based on days of the week stored in a list. The code looks like this:
days_of_theweek = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
day_count = 0
index_count = 0
hours = {}
for i in days_of_theweek:
if day_count == index_count:
the_day = days_of_theweek[index_count]
hours[the_day] = raw_input(" Enter the shift hours for " + str(the_day)+": ")
os.system('cls')
day_count += 1
index_count += 1
return hours
The problem is, running this code only returns the first iteration in the loop which is {Monday : some int}
. I know this happens because its obviously hitting the return statement after one iteration which stops the loop. Also, i notice removing the return statement allows the loop to run fine but it returns none at the end which is no good lol. My question is how do i run my whole loop and return the completed dictionary.