Please help if you can!

bobflipperdoodle at gmail.com bobflipperdoodle at gmail.com
Thu Dec 27 00:04:55 CET 2012


I really hope you can help! 
  
I need to create a program where the user can order any combination and quantity of 3 products. I then offer a 10% discount if the customer correctly answers a trivia question.  After that, there are 3 choices for shipping. 
  
I have most of the program completed but I'm struggling with the most important parts :/  I can get the total with discount to calculate only if i order every item. I also cant figure out how to get the shipping calculated correctly, including where to put any code referring back to the trivia question. Can somebody please help me with this? I would really appreciate it! 

Here is the code:

shop_again = 'y'

print("Welcome to the Star Wars Shop!")
customer = eval(input("Is there a customer in line? (1 = yes, 2 = no)> "))
while shop_again == 'y':
    if (customer == 2):
        print("Welcome to the Star Wars Memorabilia Shop!")
        customer = eval(input("Is there a customer in line? (1 = yes, 2 = no)> "))

    elif (customer == 1):
        print("Please select an item to update your order and any other number to check out.")
        print("Yoda Figure: $10 each.")
        print("Star Wars Movie DVD: $20 each.")
        print("Death Star Lego Set: $200 each.")
        print(" 1 for Yoda Figure")
        print(" 2 for Star Wars Movie DVD")
        print(" 3 for Death Star Lego Set")
    order = eval(input("Order: "))


    if (order == 1):
        yoda = eval(input("How many Yoda Figures do you want? : "))
        yodatotal = 10 * yoda
        print("Total:", yodatotal)
        print("Current order:", yoda, "for", yodatotal)
    if (order == 2):
        movie = eval(input("How many Star Wars Movie DVDs do you want? : "))
        movietotal = 20 * movie
        print("Total:", movietotal)
        print("Current order:", movie, "for", movietotal)
    if (order == 3):
        legos = eval(input("How many Death Star Lego Sets do you want? : "))
        legototal = 200 * legos
        print("Total:", legototal)
        print("Current order:", legos, "for", legototal)
    
    shop_again = input("Would you like to keep shopping? 'Y' for yes, 'N' for no: ")
    print()
print("Yoda Figures: ",yoda,"Totaling", yodatotal)
print("Star Wars Movies: ", movie,"Totaling", movietotal)
print("Death Star Legos: ", legos,"Totaling", legototal)
itemstotal = yodatotal + movietotal + legototal
print("Your order before shipping and discounts: ",itemstotal)
print()
print("Answer a trivia question for a discount!")
discount = eval(input("On what planet did Yoda live when Luke Skywalker first met him? 1) Earth 2) Dagobah 3) Pluto :"))
if (discount == 1):
    print("Sorry, that answer was wrong!")
if (discount == 2):
    print("That's correct, you get a 10% discount!")
if (discount == 3):
    print("Sorry, that answer was wrong!")
print()
if (discount == 1):
    total = itemstotal
    print("Your total before shipping: ",total)

if (discount == 2):
    total = itemstotal * .9
    print("Your total before shipping: ",total)

if (discount == 3):
    total = itemstotal
    print("Your total before shipping: ",total)
    

print("1) Regular Shipping: 3-4 business days, $5.00 per $50 ordered. 2) Express Shipping: overnight, $10 per $50 ordered. 3) Super Saver Shipping: 7-10 business days, free.")
shipping = eval(input("Please select the shipping method you want: "))

if (shipping == 1):
    
    total == total % 50
    total == total * 5
    print("Your total is: ",total)
if (shipping == 2):
    total == total/50
    total == total % 50
    total == total * 10
    print("Your total is: ",total)
if(shipping == 3):
    print("Your total is: ",total)
print()
print("Thanks for shopping here! Please come again!")



More information about the Python-list mailing list