[Tutor] Trouble with SUM()

2019-04-20 Thread Ju Bo
Hi, I'm trying to write a program that uses a while loop to ask a user for multiple values then use the program to add all the values, however many there may be, then print the sum. I'm having trouble with the sum() function. My code is below: con = "y" while con == "y": AMT = float(in

Re: [Tutor] Trouble with SUM()

2019-04-20 Thread Cameron Simpson
On 20Apr2019 16:51, Ju Bo wrote: Hi, I'm trying to write a program that uses a while loop to ask a user for multiple values then use the program to add all the values, however many there may be, then print the sum. I'm having trouble with the sum() function. My code is below: con = "y" while

Re: [Tutor] Trouble with SUM()

2019-04-20 Thread Steven D'Aprano
On Sat, Apr 20, 2019 at 04:51:11PM -0400, Ju Bo wrote: > con = "y" > while con == "y": > AMT = float(input("What is the price of the item? $")) > con = input("Would you like to continue? [y/n]") > price = float(sum(AMT + AMT)) That's a good first attempt. Rather than set

Re: [Tutor] Trouble with SUM()

2019-04-20 Thread Alan Gauld via Tutor
On 20/04/2019 21:51, Ju Bo wrote: > Hi, I'm trying to write a program that uses a while loop to ask a user for > multiple values then use the program to add all the values, however many > there may be, then print the sum. Your code very nearly does that, it just needs a slight tweak. > I'm havi