I'[ve CCd the list, please use ReplyAll when responding to the list.
On 02/08/17 22:13, Borisco Bizaro wrote: > Hi,am try to write a code that take input from user continuently > until key press it stop and give total amount user enter. > while True: > input ("enter another price :") > print"\n\n press 0 key to stop" The last line should probably be before the loop. You need to store the value somewhere, probably in a list of prices. Also you need to convert the input value to a number, probably a float in this case(although for a real system you'd probably use a Decimal or a multiplied integer for money.) You also need to check the value before you store it to see if its the last value (ie "0"). Something like value = input(....) if value == "0": break try: prices.append(float(value)) except ValueError: print "you need a number" -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor