On 05/05/15 00:08, Jag Sherrington wrote:
Hi, Alan > Enter the item's wholesale cost: 0.50 (AFTER THIS LINE PRINTS I HIT ENTER AND WOULD EXPECT THE NEXT LINE TO GIVE ME THE RESULT
But why would it? Your print code is all inside a loop that only runs if the price is negative. If you enter a positive price that code will not execute. Look at your code. Follow it through line by line.
> while another == 'y' or another == 'y': > wholesale = float(input("Enter the item's wholesale cost: ")) > while wholesale < 0: > print('ERROR: the cost cannot be negative.') > wholesale = float(input('Enter the correct wholesale cost: ')) > > #Calculate the retail price. > retail = wholesale * mark_up > > #Display the retail price. > print('Retail price: $', format(retail, ',.2f'), sep='') > > #Do this again. > another = input('Do you have another item? ' + \ > '(Enter y for yes): ')
I suspect that if you look at your books code the lines starting #Calculate the retail price. are all aligned under the first while not the second? -- 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