Jump to content
  • Advertisement

orbikk

Member
  • Content Count

    8
  • Joined

  • Last visited

Community Reputation

100 Neutral

About orbikk

  • Rank
    Newbie
  1. orbikk

    Noob Python coder, need help

    Hey, thanks that helped a lot! is there anyway I can just loop that general area? because if I choose 'y' it will ask for another item, than I type the item in then it loops the whole entire code :\
  2. Hey everyone, I'm trying to make a program where you enter what all you need to get from the grocery store. It then put's those items into a list, sorts the list than prints the list. This is the code I have as of right now.. def menu(): print "Welcome" print "What would you like to do?" print " " print "1) Create" print "2) Quit" return input("Choose an option: ") list = [] def add(raw_input): list.append( (raw_input) ) loop = 1 choice = 0 while loop == 1: choice = menu() if choice == 1: add(raw_input("Enter an item: ")) q = raw_input("Would you like to add another item? y/n: ") if q == y: add(raw_input("Enter an item: ")) if q == n: loop = 0 elif choice == 2: loop = 0 print "end" When I run it, it runs normally, It allows me to enter my first item, and it puts it into the list, it than ask, "would you like to add another item? y/n and if i hit either y or n it gives me this error.. Traceback (most recent call last): File "C:\Python24\test1", line 23, in -toplevel- if q == y: NameError: name 'y' is not defined I thought since i was using q = raw_input I figured it would work, i'm not too sure whats wrong. Can anyone help?
  3. orbikk

    Python programming, help :]

    Hey, thanks for the reply! Your codes are really great and work well! Your code does exactly what I want it to, I want it to sort by names, and hours. Although, I want it to sort by the time first, than sort by the name. The main thing I want the code to do is choose "three" different breaks for each person. For example.. If John is working from 8 - 4 His 1st (15 Minute) break would be at 10:15 His 2nd (30 Minute) break would be at 12:00 His 3rd (15 Minute) break would be at 2:30 Although only people working 6+ hours can have a 30 minute lunch break. Also, no more than 2 people can have a break at the same time.
  4. orbikk

    Python programming, help :]

    Hey, I tried putting that code into there and when I run the program, it says "Enter First Name:" and I enter Justin, and it gives me this error. Traceback (most recent call last): File "C:\Python24\program", line 16, in -toplevel- firstName = input("Enter first name: ") File "<string>", line 0, in -toplevel- NameError: name 'Justin' is not defined this is the code im using def menu(): print "Welcome to breaksheet V1!" print "" print "What would you like to do?" print "" print "1) Create New Break Sheet" print "2) Quit" print "" return input ("Choose an option: ") employeeNames = [] gettingNames = True while gettingNames == True: firstName = input("Enter first name: ") lastName = input("Enter last name: ") employeeNames.append( (lastName, firstName) ) ## Add to list enterAnother = input("Add another employee? (y/n)") if enterAnother.lower() == "n": ## lower converts to lower case gettingNames = False employeeDetails = [] for name in employeeNames: print ("Employee: " + name[1] + " " + name[0]) shiftStart = input("Start hour: ") shiftDuration = input("Shift duration: ") employeeDetails.append( (shiftStart, shiftDuration, name[0], name[1]) ) employeeDetails.sort() print (employeeDetails)
  5. orbikk

    Python programming, help :]

    Say I want the program to run, and it's going to ask for the list of names of people that are working that day.. So you type the names in, and they automatically get placed into the list of names, then it will come up with what time will "so and so" be arriving, and than it will ask how many hours will they be working and you put that in. I need a program where it ask for information and you type it in, not so much a program where I put all the information in.
  6. orbikk

    Python programming, help :]

    no one knows??
  7. orbikk

    Python programming, help :]

    So I need to know how to add in a code for whenever someone types in the workers name it puts it into the phonebook. Here is what im looking for.. - Collect the names of the people that will be working - Collect the hours they will be working - Take the people with the earliest hours - Put them into alphabetical order - Give each person a 15 minute break, a 30 minute lunch, and an additional 15 minute break - Do not allow more than 2 people have break at the same time - Only people working 6 hours + gets a 30 minute lunch break [Edited by - orbikk on October 13, 2010 4:59:24 PM]
  8. Hey everyone, I'm a beginner at programming and heard python is the best to start out with to learn the basics. I have read tutorials online and have learned a good bit. I am interested in making a program to automates breaks for people at work. for example. I want the program to take the names entered, and the hours they are working, i want it to first do the sort() to sort the hours numerically in order than take than take those and sort() the names of the people alphabetically so for example it would output like this.. Andy 8 - 4 Billy 8 - 4 Anyhow, I have the menu coded which was very simple to do.. This is the code I have so far. not very far sorry :\ I put in comments where I need help at, thanks :] __________________________________________________________________________ def menu(): print "Welcome to breaksheet V1!" print "" print "What would you like to do?" print "" print "1) Create New Break Sheet" print "2) Quit" print "" return input ("Choose an option: ") phonebook = {} ## <-- I created a blank phonebook so whenever they create a name it gets put into the phonebook? def create(a,b): ## <--- Here is the create option, I'm not sure which code I should use to actually make it when they type in the name it gets put into the phone book loop = 1 choice = 0 while loop == 1: choice = menu() if choice == 1: print " " create(input("First Name: "),input("Last Name: ")) [Edited by - orbikk on October 13, 2010 4:21:51 PM]
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!