4 Replies - 475 Views - Last Post: 13 August 2014 - 03:30 PM Rate Topic: -----

#1 josephpugh  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 13-August 14

I'm making a pizza ordering system and i am stuck.

Posted 13 August 2014 - 02:23 PM

I'm stuck with my pizza ordering program:

pizza = raw_input("Enter a pizza type:")
if menu != ValueError:
print('That is not a pizza name (try with capitals or check spelling).')

This is part of the coding that is the problem. I'm wanting them to choose a pizza from my menu, but if they get the spelling wrong than I want it to say 'That is not a pizza name (try with capitals or check spelling).'. I want it to keep looping this until they get the spelling of the pizza correct. How do I do this? :)/>

Is This A Good Question/Topic? 0
  • +

Replies To: I'm making a pizza ordering system and i am stuck.

#2 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3516
  • View blog
  • Posts: 12,007
  • Joined: 12-December 12

Re: I'm making a pizza ordering system and i am stuck.

Posted 13 August 2014 - 02:34 PM

You need to show more code, wrapped in code tags.

Note that you cannot compare to ValueError, this is an Exception that you would catch.

However, your code should also demonstrate more of an effort to solve this.
Was This Post Helpful? 0
  • +
  • -

#3 josephpugh  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 13-August 14

Re: I'm making a pizza ordering system and i am stuck.

Posted 13 August 2014 - 02:41 PM

Okay thanks. I dont know much about this website so still learning. I'm also just learning python.

menu = {

    "Pepperoni": 8.50,

    "Cheese": 8.50,

    "Hawaiian": 8.50,

    "Meat Lovers": 8.50,

    "BBQ Chicken": 8.50,

    "Plain" : 8.50,

    "Italian": 8.50,

    "Chicken & Cranberry": 13.50,

    "Mushroom": 13.50,

    "Mediterraean": 13.50,

    "Meat Surpreme": 13.50,

    "Cheese Surpreme": 13.50

 }

pizza = raw_input("Our choice of pizzas are: Pepperoni, Cheese, Hawaiian, Meat Lovers, BBQ Chicken, Plain and Italian for only $8.50.\nWe also have Chicken & Cranberry, Mushroom,"
                  "Mediterranean, Meat Surpreme and Cheese Surpreme for $13.50.\n\nPLEASE PRESS ENTER TO ORDER." )
  

pizza = int(raw_input('Enter a pizza type:'))


if menu.get(pizza) != None:

   price = "%.2f" % menu.get(pizza)

   print("That will be " + str(price) + " please. ")

   pizza = raw_input("Would you like to order another pizza? Y/N:")

This post has been edited by andrewsw: 13 August 2014 - 03:19 PM
Reason for edit:: Use CODE tags

Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3516
  • View blog
  • Posts: 12,007
  • Joined: 12-December 12

Re: I'm making a pizza ordering system and i am stuck.

Posted 13 August 2014 - 03:19 PM

You need to wrap your code in code-tags, it demonstrates how to do this directly in the area where you are typing your post. This is particularly important for Python code.

Anyway, I've added them on this occasion.

So what's the problem with your code?
Was This Post Helpful? 0
  • +
  • -

#5 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3516
  • View blog
  • Posts: 12,007
  • Joined: 12-December 12

Re: I'm making a pizza ordering system and i am stuck.

Posted 13 August 2014 - 03:30 PM

One of the first things to correct is that you are asking for an integer, but then looking up this value as though it were a string such as "Cheese".
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1