vendredi 6 novembre 2020

how to get rid of Nontype array

I want to have an array with random binary values, its length is p, but I get the error:

AttributeError: 'NoneType' object has no attribute 'type'

this is my code

import random
def length(p): 
    binary = [] 
    for i in range(p): 
        temp = random.randint(0, 1)
        binary.append(temp )    
    print(binary) 
fn=length(5)
fn.type



Aucun commentaire:

Enregistrer un commentaire