0
#
print ('Let me help you order a pizza. What size would you like?'
 ' a. small ($7.99)  b. medium ($14.99)  c. large ($18.99)')
choice = input('Please enter a or b or c: ')
prices =  {'a':7.99 , 'b':14.99 , 'c':18.99} 
if choice == 'asdf' :
   print("Ok fam, you became a god, heres the keys and my chick, pizzas still the same tho.")
elif choice == 'a' :
    print("Ok fam, lemme hook you up, a small pizza. There 7.99 each.")

elif choice == 'b':
    print("Ok fam, lemme hook you up, a medum pizza. There 14.99 each.")

elif choice == 'c':
    print("Ok fam, lemme hook you up, a large pizza. There 18.99 each.")

else:
    print("you bum, you had 3 options")

amount = choice * input('How many would you like?')

print ('Your total is  %.2f' % (amount * prices[choice]))

i cannot get this to compile/ work i would like help with the last line, i cannot figure out how to mutiply numbers in strings to get a num value, thanks, ace

2
Contributors
4
Replies
38
Views
5 Months
Discussion Span
Last Post by rproffitt
1

On line 20, why are you multiplying choice (a character) by the input? Looks odd doesn't it?

0

@rproffitt i did not intend to downvote, your help is welcome, appologies

1

I see upvote +1 so far.

Anyhow, do you see it now?
amount = choice * input('How many would you like?')
might need to be.
amount = input('How many would you like?')

I didn't test this to see if you need to write
amount = int(input('How many would you like?'))

Votes + Comments
thank you sir, i will make the changes and see if it works.
1

Ace, I think you misunderstand me. I did not test your code. I only pointed out what looks odd or off. If I fix the code, I need your teacher's email address to share that.

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.