Home > Enterprise >  How do I get for loop to print the equation for each value
How do I get for loop to print the equation for each value

Time:09-30

How do I get for loop to print the equation for each value (1, 2, etc.) Instead of just the final value 10 times. How to print distance at every second.

enter image description here

CodePudding user response:

Replace t with seconds in your calculation of d. As it is, you are calculating d t-times with t**2. As far as I understand, you want to calculate it t-times but print the distance after every second. So t has to be replaced with the variable you called seconds

And then either print in your function fallingDistance. Or call your function t-times and print the result in your main()

  • Related