# Convert function result value to over pi

Asked 2 weeks ago, Updated 2 weeks ago, 1 views

``````import numpy as np

u = np.random.randint(2,size=(1,100))
print(u)

print(np.size(u,1))

def turbo_enc(u):
K = np.size(u,1)
print(K)
enc = np.zeros_like(u)
enc = u
return enc
enc1 = turbo_enc(u)
print(enc1)

if((x+y+z) % 2 == 0):
return 0
else:
return 1

a1 = np.array((0))
a2 = np.array((0))
def loop(u):
global a1
global a2
for i in range(99):
if(i==0):
elif(i == 1):
a1 = enc1
else:
a1 = enc1[i-1]
a2 = enc1[i-2]

loop(u).reshape(10,10)
``````

'add function' = 0 return if added value is even, 1 return if odd

That's the code I've written so far. I am writing 'Turbo code with interleaver', which is a college assignment, in Python. The overall process is as follows:

numpy def

2022-09-20 10:23

I don't know exactly what it means. First of all, I will explain the reason why the error.

``````def loop(u):
#...
``````

In this way, the return value of the `loop` function passes the return value of the `print` function as it is. The return value of the `print` function is `None`.

Thus, `loop(u)` becomes `None`, and `loop(u).Reshape(10,10)` is the same as `None.reshape(10,10)`. However, since `None` does not have a method called `reshape`, the error `'NoneType' object has no attribute 'reshape'` occurred.

I think it's a difficult explanation for the questioner, but read it 10 times.

2022-09-20 10:23

## If you have any answers or tips

Popular Tags
python x 4520
android x 1589
java x 1455
javascript x 1363
c x 881
php x 682
html x 629
swift x 586
ios x 538
mysql x 397