Python Forum
How to print out multiple drinks instead of just one based on the input?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to print out multiple drinks instead of just one based on the input?
#1
coffee=4
tea=3
coke=2
print()
menu={'Coffee':'$4.00','Tea':'$3.00','Coca-cola':'$2.00',"Press 'd' ":"complete order"}
ccount=0
tcount=0
cokecount=0
while True:
    for i in menu:
        print(f"{i}={menu[i]}")
    print()


    Condition=True
    while(Condition):
        drink=input('Select your drink from the menu:')
        drink=drink.capitalize()

        if drink == 'Coffee':
              quantity=int(input('Quantity:'))
              ccount+=quantity
              Condition=False
        elif drink == 'Tea':
             quantity=int(input('Quantity:'))
             tcount+=quantity
             Condition=False
        elif drink == 'Coca-cola':
             quantity=int(input('Quantity:'))
             cokecount+=quantity
             Condition=False

        elif drink=='D':
            condition=False
            amount=( ccount*4)+(tcount*3)+(cokecount*2)
            mem=input('Do u have membership?( Enter Y for yes, N for no):')
            mem=mem.capitalize()
            if amount>=10 and mem=='Y':
                purchaseDisc=amount*0.05
                memDisc=(amount-purchaseDisc)*0.15
                befTotal=(amount-purchaseDisc-memDisc)
                gst=befTotal*0.07
                total=befTotal+gst

            elif amount<10 and mem=='Y':
                purchaseDisc=0
                memDisc=amount*0.15
                befTotal=amount-memDisc
                gst=befTotal*0.07
                total=befTotal+gst

            elif amount>=10 and mem=='N':
                purchaseDisc=amount*0.05
                memDisc=0
                befTotal=amount-purchaseDisc
                gst=befTotal*0.07
                total=befTotal+gst

            else:
                purchaseDisc=0
                memDisc=0
                befTotal=amount
                gst=befTotal*0.07
                total=befTotal+gst


            print()
            print('Receipt')
            print('==============================')
            print(f'{"Drink":5s}:               {drink:>1s}')
            print(f'{"Quantity":8s}:{quantity:>13}')
            print(f'{"Member":6s}:{mem:>15}')
            print(f'{"Amount":6s}:{"$":>15}{amount:>5.2f}')
            print(f'{"Purchase Disc.":14s}{"$":>8}{purchaseDisc:>5.2f}')
            print(f'{"Member Disc.":12s}{"$":>10}{memDisc:>5.2f}')
            print(f'{"Total (bef. GST)":16s}{"$":>6}{befTotal:>5.2f}')
            print(f'{"GST":3s}{"$":>19}{gst:>5.2f}')
            print(f'{"Total (incl. GST)":17s}{"$":>5}{total:>5.2f}')
            exit()
        else:
             print('Please enter a drink from the menu!')
             Condition=True
How can i print out the different drinks and quantity that i inputted instead of just printing out 1?
Reply


Messages In This Thread
How to print out multiple drinks instead of just one based on the input? - by jayfre - Jun-30-2020, 05:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Change elements of array based on position of input data Cola_Reb 6 2,113 May-13-2022, 12:57 PM
Last Post: Cola_Reb
  How to map two data frames based on multiple condition SriRajesh 0 1,474 Oct-27-2021, 02:43 PM
Last Post: SriRajesh
  Exit function from nested function based on user input Turtle 5 2,898 Oct-10-2021, 12:55 AM
Last Post: Turtle
Exclamation question about input, while loop, then print jamie_01 5 2,660 Sep-30-2021, 12:46 PM
Last Post: Underscore
  Xlsxwriter: Create Multiple Sheets Based on Dataframe's Sorted Values KMV 2 3,487 Mar-09-2021, 12:24 PM
Last Post: KMV
Question How to print multiple elements from multiple lists in a FOR loop? Gilush 6 2,932 Dec-02-2020, 07:50 AM
Last Post: Gilush
  Loop back through loop based on user input, keeping previous changes loop made? hbkpancakes 2 2,938 Nov-21-2020, 02:35 AM
Last Post: hbkpancakes
  How to print string multiple times on new line ace19887 7 5,731 Sep-30-2020, 02:53 PM
Last Post: buran
  print function help percentage and slash (multiple variables) leodavinci1990 3 2,475 Aug-10-2020, 02:51 AM
Last Post: bowlofred
  taking input doesnt print as list bntayfur 2 2,108 Jun-04-2020, 02:48 AM
Last Post: bntayfur

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020