dimanche 15 octobre 2017

unsupported operand type(s) for /: 'list' and 'list' Python

I need to generate 10 random numbers in 2 variables and calculated the ratio between them. My code is below. What am I doing wrong?

from random import randint N=10 a = [random.randint(0, 10) for _ in range(N)] b = [random.randint(0, 10) for _ in range(N)] print (a,b) ratio = a/b

TypeError: unsupported operand type(s) for /: 'list' and 'list'




Aucun commentaire:

Enregistrer un commentaire