I've managed to get this function to iterate over the list. What I want is a way to include the current list element in the output string. ie. (raw_input("Enter the number of hours the employee worked on : "))
showing Monday or Tuesday or which ever element the function is at.
# -*- coding: utf-8 -*-
day = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
def hours():
while True:
try:
hours = int(raw_input("Enter the number of hours the employee worked on : "))
if (hours >=0) and (hours <=24):
return hours
else:
print ("Please enter a whole number that is more than zero & less than 24")
except ValueError:
print ("Please enter a whole number that is more than zero & less than 24")
continue
for i in day:
print hours()