15,799,186 members
See more: , +
hello, apparently the program works well, but I needed to consider the value 0 also in the for result, for example if I put length 5 and points 10, it should return

0.0
0.5
1.0
1.5
2.0
2.5
3.0
3.5
4.0
4.5
5.0

What I have tried:

```from math import *
a=int(0)

l=float(input('indicate the length of the beam = '))

np =int(input('indicate the number of points on the beam = '))

for i in range(0,np):
a+=(l/np)
print("%.1f" % a)```
Posted
Updated 22-Jul-22 18:12pm

## Solution 1

Quote:
apparently the program works well, but I needed to consider the value 0 also in the for result

Try this:
Python
```for i in range(0,np+1):
print("%.1f" % a)
a+=(l/np)```

CPallini 23-Jul-22 7:52am
5.
Patrice T 23-Jul-22 7:56am
Thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Top Experts
Last 24hrsThis month
 Dave Kreskowiak 150 Richard MacCutchan 70 Kenneth Haugland 45 Bassam Abdul-Baki 36 KarstenK 35
 Dave Kreskowiak 565 Richard Deeming 538 Maciej Los 380 Andre Oosthuizen 360 Richard MacCutchan 313

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900