Create your own


#1

This is the code I came up with. Do you think I should’ve done something more? I’m already 60%+ into Python, I know that I should be able to do more, but nothing comes to mind.

choices = ['pizza', 'pasta', 'salad', 'nachos']

print 'Your choices are:'
for index, item in enumerate(choices):
    print index + 1, item
for item in choices:
    user_order = raw_input("What would you like to have? ")

    if user_order == 'pizza':
        print "That'll be 20$."
        break

    elif user_order == 'salad':
        print "That'll be 100$"
        break

    else:
        print "You haven't ordered anything"

#2

More of what?

I think it’s very odd for the program to use the number of choices as the number of attempts to get input from the user, doesn’t seem to me like those two things are related.


#3

@casphor,

On the forums, always post a link to the exercise in question.

In the Create your own exercise, you are asked to create a for/ else statement. Is that what you have done?


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.