If anybody can help me get started in my code, I would be extremely appreciative. I have a school project due soon, and I am having a hard time getting past the first section of my assignment. If anybody can help me work with my code that I have I have in place, I would be ecstatic. I have been staring at the screen and digging through my text book/internet for hours, and I can't move on until I get this part down. Down below is the part of the assignment I could use a hand on.
Ask user to enter payroll info. Set up a loop that continues to ask for information until they enter "DONE." For each employee ask three questions.
~name (first and last)
~hours worked this week (only allow 1 through 60)
~hourly wage (only allow 6.00 through 20.00)
Validate the hours worked and the hourly wage, and make sure the name is entered.
I understand I have not gotten to the point of adding up the hours worked or wage. I am stuck on the loop, and I would love to get the loop done before I move on. My challenge is when I enter my raw_input into my blank list, it only documents my most recent information entered, and kicks out any previously entered information. Here is my code so far.
names = [] ###blank list
hours = [] ###blank list
wages = [] ###blank list
names = "blank"
hours = "empty"
wages = "nothing"
finished = "nada"
while finished.lower() !="done":
names = raw_input("Please enter first and last name of your employee:")
hours = raw_input("Please enter number of hours worked:")
wages = raw_input("Please enter employee wage:")
finished = raw_input("if finished, type 'done', or else press enter to add more:")
if finished == "done":
continue
else:
print "Enter more employees information:"
print names
print hours
print wages
I also know some recommend using functions to accomplish this task, my challenge with that is I am not very experienced with functions. If anybody has any guidance for me, please help. Thanks so much!
Ask user to enter payroll info. Set up a loop that continues to ask for information until they enter "DONE." For each employee ask three questions.
~name (first and last)
~hours worked this week (only allow 1 through 60)
~hourly wage (only allow 6.00 through 20.00)
Validate the hours worked and the hourly wage, and make sure the name is entered.
I understand I have not gotten to the point of adding up the hours worked or wage. I am stuck on the loop, and I would love to get the loop done before I move on. My challenge is when I enter my raw_input into my blank list, it only documents my most recent information entered, and kicks out any previously entered information. Here is my code so far.
names = [] ###blank list
hours = [] ###blank list
wages = [] ###blank list
names = "blank"
hours = "empty"
wages = "nothing"
finished = "nada"
while finished.lower() !="done":
names = raw_input("Please enter first and last name of your employee:")
hours = raw_input("Please enter number of hours worked:")
wages = raw_input("Please enter employee wage:")
finished = raw_input("if finished, type 'done', or else press enter to add more:")
if finished == "done":
continue
else:
print "Enter more employees information:"
print names
print hours
print wages
I also know some recommend using functions to accomplish this task, my challenge with that is I am not very experienced with functions. If anybody has any guidance for me, please help. Thanks so much!