Mar-15-2021, 02:54 PM
number of issues:
you start with
what is h?
you claim you cannot write
you start with
a
being, number of cases, while in the previous post that is b column.what is h?
you claim you cannot write
a
column, but you print a? I guess there is some confusion between a and b in the previous example and here.def calculate(cases, rate): return int(cases * (rate / 100 + 1)) n = 1 cases = int(input('Number of cases: ')) # do you really want a float for cases rate = float(input('Percentage increase: ')) while cases <= 3000: print(f'{n}) {cases}') cases = calculate(cases, rate) n += 1
Output:Number of cases: 150
Percentage increase: 50
1) 150
2) 225
3) 337
4) 505
5) 757
6) 1135
7) 1702
8) 2553
in your original post the column b increase by fixed number - 150, not by given percent in which case you can use a for loop
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs