mercredi 25 janvier 2017

Cannot call the variable in formula

I am doing this python programming and stuck with an issue. The program cannot call the value of the n_zero when I put it in the conditional statement.

Here's the program

import numpy as np

n_zero=int(input('Insert the amount of 0:  '))
n_one =int(input('Insert the amount of 1: '))
n_two =int(input('Insert the amount of 2: '))
n_three = int(input('Insert the amount of 3: '))

data = [0]*n_zero + [1]*n_one + [2]*n_two + [3]*n_three
print len(data)

if len(data)==(2(n_zero)-1):
    np.random.shuffle(data)
    datastring = ''.join(map(str, data))
    print ("Data string is : %s " % datastring )


else:
    print(error)

this is the error

    if len(data)==(2(n_zero)-1):
TypeError: 'int' object is not callable

Thank you

Aucun commentaire:

Enregistrer un commentaire