so I've been up trying to figure this out, so much that my code is probably off the wall.
Ask the user to enter payroll information for the company. Set up a loop that continues to ask for information until the user enters “DONE”. For each employee ask three questions:
name (first & last name together as a single response)
hours worked this week (only allow 1 through 60)
hourly wage (only allow 6.00 through 20.00)
here is my code SO FAR:
http://pastebin.com/tngjF1Pf someone please help, I know I went wrong somewhere/everywhere
Python
Quoted By:
yes, I just started learning :(
Anonymous
Quoted By:
>>17255406 you are something else, I wasn't this shit at coding even when I was 5
Anonymous
Quoted By:
what's with the variable=""? I don't think you need to do that. I take it you haven't got to comments yet either?
Anonymous
Quoted By:
OP, you're doing numerical checking against strings. You have a while loop that will run forever at the beginning. Why don't you just give the fuck up and die?
Anonymous
Anonymous
Quoted By:
OP here, thanks. But like i said ive been switching it around its all half assed. could any of you show me what its suppose to look like then?
Anonymous
Anonymous
Quoted By:
>>17255575 No, you would succeed at losing, which means that you would still lose.
OP, do the boring lessons first.
Google "Learn Python the hard way first."
Anonymous
Anonymous
If I interpret this correctly, the user should be asked the 3 questions over and over until they type DONE? You are doing it backwards and printing done whenever someone enters a 0. If I'm correct in interpreting this task you only need one while loop too.
Anonymous
Quoted By:
>>17255625 yea, i was a little confused by the wording.
could you show me what you mean on pastebin?
Anonymous
Quoted By:
could someone please just show me how to do this, so i can shut the fuck up. I've been up all night doing SQL. I need to get this done asap.
Anonymous
Anonymous
Anonymous
Anonymous
Ok OP, this is hardly perfect but should give the jist of it. Notice if you enter a non-numeric letter when asked for salary etc the program will crash. You need to handle this with exceptions. Also the data should probably be stored in a list or dictionary. But I assume this is early level python so we dont worry about that yet.
Anyway:
http://pastebin.com/Kbmu40q1 Notice I'm not the greatest python programmer, hope it helps.
I created loops inside the other loops, thats why in the first loop I could use break but in the sub-loops I had to use sys.exit() to exit the entire program, break would only get us out to the upper level loop.
fuckdell !TIvoFfGlIs
Quoted By:
dude, this isn't even that hard. I had to do this something in fucken C++ and C++ is much harder.
Anonymous
Quoted By:
well..........................shit
Anonymous
Haven't written Python in awhile, but the idea would be something like this.
http://pastebin.com/rfMy2uwT Anonymous
>>17255995 Noticed some errors in my own code.
Updated version:
http://pastebin.com/JZ1LxkTU Anonymous
>>17255995 Its just looping me threw enter name, and enter hours
Anonymous
>>17256122 see updated post
Anonymous
>>17256101 I'm getting a syntax error on the while for hours
Anonymous
>>17256178 As I said, I haven't written Python in awhile, so there's probably a ton of syntax issues, but the logic is there.
HomeworkPolice !TIvoFfGlIs
Quoted By:
>>17256178 he's not going to do the homework for you.
Anonymous
Quoted By:
>>17256194 Yup, I think OP would benefit from actually thinking about WHY he's getting errors :-)
Anyway, this code seems to work adequate:
>>17256114 Anonymous
>>17256124 you got it. hey Thanks you saved me on this one.
Anonymous
Quoted By:
>>17256225 np, but you really should be attending classes
Anonymous
>>17256225 Just in case you're still here, I fixed my code from
>>17256101 I had made some really stupid mistakes honestly because I was only half-assing it, but I was bored, so here you are.
http://pastebin.com/1zCG0LXc Anonymous
>>17256347 Honestly, yours is cleaner than mine. But I think OP is long gone by now :-)
Anonymous
>>17256382 I figured, but I got bored enough to figure out what the hell was wrong with it, so I figured I would go ahead and post.
Anonymous
Quoted By:
>>17256407 i know that feeling
can't put things to rest if it's not done right