Hello everyone,
This might be a fairly simple question but I am new to python and taking an online class pretty much instructing myself. Below is the problem with my current code.
# 11. Weight Loss
# If a moderately active person cuts their calories intake by 500 calories a day,
# they can typically lose about 4 pounds a month. Write a program that lets the
# user enter their starting weight, then creates and displays a table showing
# their expected weight will be at the end of each month for the next 6 months
# if they stay on this diet.
This might be a fairly simple question but I am new to python and taking an online class pretty much instructing myself. Below is the problem with my current code.
# 11. Weight Loss
# If a moderately active person cuts their calories intake by 500 calories a day,
# they can typically lose about 4 pounds a month. Write a program that lets the
# user enter their starting weight, then creates and displays a table showing
# their expected weight will be at the end of each month for the next 6 months
# if they stay on this diet.
currentweight = int ( input ( "Enter your current weight: " ) ) monthlyloss = -4 for currentmonth in range ( 1, 7): weightlosspermonth = (currentweight + monthlyloss) print ( currentmonth, "\t", weightlosspermonth )The following is my output:
Output:Enter your current weight: 200
1 196
2 196
3 196
4 196
5 196
6 196
Essentially, everytime the code loops, it should subtract 4 from the currentweight. At the end of the 6 months there should be 24 lbs lost. I can only get it to loop once subtracting the initial 4 pounds from the same weight everymonth. Can someone help me identify the issue?