jeudi 21 mai 2015

Python 2.7 and random

I am trying to run the following code...

# -*- coding: utf-8 -*-
import random

def randomList():
    l = []
    for i in range(0, 20):
        l.append(random.randint(-100, 100)
    return l 

def displayList (l):
    for i in l:
        print (i)

listeAleatoire = randomList()

displayList( listeAleatoire )

However, at the return it show me the following error:

"[...], line 8 return l SyntaxError: invalid syntax"
     ^

I am a bit helpless, maybe you could help, before I get all my hair away... Thank you!




Aucun commentaire:

Enregistrer un commentaire