I have defined some data, which appends to some lists. in order to do this, I need to put them into some sort of nested loop condition. First a range between 1-15 creates then rebarnumber calculates, within the loop, I set those conditions when n <= rebarnumber is matched, *do something*, then continue when n >= rebarnumber do something else. The problem is when above conditions fullfilled, I do except to get list with full length of range numbers.
But instead gets this result.
[49.0] 1
[49.0, 49.0] 2
[49.0, 49.0, 49.0] 3
[49.0, 49.0, 49.0, 49.0] 4
[49.0, 49.0, 49.0, 49.0, 49.0] 5
[49.0, 49.0, 49.0, 49.0, 49.0, 49.0] 6
[49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 49.0] 7
[49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 84.0] 8
[49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 84.0, 49.0, 84.0] 9
[49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 84.0, 49.0, 84.0] 10
[49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 84.0, 49.0, 84.0] 11
[49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 84.0, 49.0, 84.0] 12
[49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 84.0, 49.0, 84.0] 13
[49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 84.0, 49.0, 84.0] 14
[49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 84.0, 49.0, 84.0] 15
Desired result, (just shown last 2 lines of print)
[49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 84.0, 84.0, 84.0, 84.0, 84.0, 84.0, 84.0] 14
[49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 49.0, 84.0, 84.0, 84.0, 84.0, 84.0, 84.0, 84.0, 84.0] 15
The code:
h = 300
cb = 35
ct = 35
ca = 35
b= 300
y = 12
d = h - cb
ds = ct
a = 25
yb = 8
rebarnumber = math.floor((b-(2*cb+2*yb+y))/a)
disc = []
dis = []
Asi = []
Asci = []
for n in range(1,16):
if n <= rebarnumber+1:
Asi.append(int(3.1416/4*(y)**2))
dis.append( h - (cb + yb + y/2 ))
Asci.append(int(3.1416/4*(y)**2))
disc.append( ct + yb + y/2 )
if n >= rebarnumber:
Asi.append(int(3.1416/4*(y)**2))
dis.append( h - (cb + yb + y/2 ) - ca)
Asci.append(int(3.1416/4*(y)**2))
disc.append( cb + yb + y/2 + ca)
print(disc, n)
What's it I do wrong?! any help!
ifblock one level (and maybe adjust the condition).