Hello, everyone. Im new to programming and Ireally love solving problems. I dont have all the answers, however. I am taking a python class at my local CC. We had a project about writing an interface for a beverage machine. I have already been graded on this, I turned it in incomplete because I got stuck on the final part. I am having trouble figuring out how to write the interface for accepting payment and comparing it to the balance of the sale. When I try to use an if statement after "userPayment=", I keep getting an EOF while parsing. If you could give me feedback on that, how to write the final part of my program which does userpayment>totalprice and prints the change to be dispensed or not enough credit for sale. or any other part of my code that would be great. I dont think its written very efficiently so if I have any lines that are not necessary and can be written in less lines I would also like to know that. This is actually the first program Ive ever written. Thanks in advance.
#Create Welcome drinkPrice0=float(1.50) drinkPrice1=float(1.25) drinkPrice2=float(1.75) drinkPrice3=float(2.00) drinkMedium=int(2) drinkLarge=int(3) print('Hello and welcome to the beverage center') print(""" """) #listing items available to purchase print('Here are the choices available') print(""" """) print('Item 1: Coca-Cola...Small $1.50...Medium $3.00...Large $4.50') print('Item 2: Root Beer...Small $1.25...Medium $2.50...Large $3.75') print('Item 3: Bottle Water...Small: $1.75...Medium $3.50...Large $5.25') print('Item 4: Apple Juice...Small $2.00...Medium $4.00...Large $6.00') print(""" """) #user selecting drink while True: try: drinkChoice=int(input('Enter the number of your item please: ')) if drinkChoice==1: print(""" """) print('Coca-Cola selected...Small $1.50...Medium $3.00...Large $4.50') break elif drinkChoice==2: print(""" """) print('Root Beer selected...Small $1.25...Medium $2.50...Large $3.75') break elif drinkChoice==3: print(""" """) print('Bottle Water selected...Small $1.75...Medium $3.50...Large $5.25') break elif drinkChoice==4: print(""" """) print('Apple Juice selected...Small $2.00...Medium $4.00...Large $6.00') break except ValueError: print(""" """) print('Invalid item number, try again.') else: break #user selecting size print('Now enter the size of your drink') print(""" """) print("'S' for Small") print("'M' for Medium") print("'L' for Large") print(""" """) #drink price and size multiplied sizeSelected=input('What size would you like? ') while True: try: if drinkChoice==1 and sizeSelected.upper()=='S': smallCoke=float(1.50) print('Your total is $ ', format(smallCoke,'.2f')) break elif drinkChoice==1 and sizeSelected.upper()=='M': mediumCoke = float(drinkPrice0*drinkMedium) print('Your total is $ ', format(mediumCoke,'.2f')) break elif drinkChoice==1 and sizeSelected.upper()=='L': largeCoke=float(drinkPrice0*drinkLarge) print('Your total is $ ', format(largeCoke,'.2f')) break elif drinkChoice==2 and sizeSelected.upper()=='S': smallRootBeer=float(drinkPrice1) print('Your total is $ ', format(smallRootBeer,'.2f')) break elif drinkChoice==2 and sizeSelected.upper()=='M': medRootBeer=float(drinkPrice1*drinkMedium) print('Your total is $ ', format(medRootBeer,'.2f')) break elif drinkChoice==2 and sizeSelected.upper()=='L': largeRootBeer=float(drinkPrice1*drinkLarge) print('Your total is $ ',format(largeRootBeer,'.2f')) break elif drinkChoice==3 and sizeSelected.upper()=='S': smallWater=float(drinkPrice2) print('Your total is $ ',format(drinkPrice2,'.2f')) break elif drinkChoice==3 and sizeSelected.upper()=='M': medWater=float(drinkPrice2*drinkMedium) print('Your total is $ ',format(medWater,'.2f')) break elif drinkChoice==3 and sizeSelected.upper()=='L': largeWater=float(drinkPrice2*drinkLarge) print('Your total is $ ',format(largeWater,'.2f')) break elif drinkChoice==4 and sizeSelected.upper()=='S': appleJuice=float(drinkPrice3) print('Your total is $ ',format(drinkPrice3,'.2f') ) break elif drinkChoice==4 and sizeSelected.upper()=='M': medAppleJuice=float(drinkPrice3*drinkMedium) print('Your total is $ ',format(medAppleJuice,'.2f')) break elif drinkChoice==4 and sizeSelected.upper()=='L': largeAppleJuice=float(drinkPrice3*drinkLarge) print('Your total is $ '),format(largeAppleJuice,'.2f') break except ValueError: print ("One of your inputs was invalid, please try again") continue #establishing a final price for user to pay if drinkChoice==1 and sizeSelected.upper()=='S': totalPrice=float(drinkPrice0) elif drinkChoice==1 and sizeSelected.upper()=='M': totalPrice = float(drinkPrice0*drinkMedium) elif drinkChoice==1 and sizeSelected.upper()=='L': totalPrice=float(drinkPrice0*drinkLarge) elif drinkChoice==2 and sizeSelected.upper()=='S': totalPrice=float(drinkPrice1) elif drinkChoice==2 and sizeSelected.upper()=='M': totalPrice=float(drinkPrice1*drinkMedium) elif drinkChoice==2 and sizeSelected.upper()=='L': totalPrice=float(drinkPrice1*drinkLarge) elif drinkChoice==3 and sizeSelected.upper()=='S': totalPrice=float(drinkPrice2) elif drinkChoice==3 and sizeSelected.upper()=='M': totalPrice=float(drinkPrice2*drinkMedium) elif drinkChoice==3 and sizeSelected.upper()=='L': totalPrice=float(drinkPrice2*drinkLarge) elif drinkChoice==4 and sizeSelected.upper()=='S': totalPrice=float(drinkPrice3) elif drinkChoice==4 and sizeSelected.upper()=='M': totalPrice=float(drinkPrice3*drinkMedium) elif drinkChoice==4 and sizeSelected.upper()=='L': totalPrice=float(drinkPrice3*drinkLarge) userPayment=float(input('Enter amount of money to be inserted, including dollars and cents $ '))