I'm totally new to python and i'm making a program using python that will ask the user to enter the number of chocolates they would like to purchase. But the problem is how can i get the user to input the number of chocolates in multiples of 12, so basically a dozen. If the input is not a multiple of 12 then ask them to re-enter the number of chocolates in multiples of 12. Please help me.

numberChocolate=0while numberChocolate!="q": numberChocolate=int(input("Enter number of chocolates you would like to buy:")) if numberChocolate%12: print("Enter the number of chocolate in a dozen.") else: print("Thank you") break

Pretty good. You still need to add some error checking though (probably with try/except). Currently your program will crash if it is given anything other than an integer. Even 'q' which you intended to quit the loop actually crashes the program.