vendredi 24 novembre 2017

How to generate a random number in python [duplicate]

This question already has an answer here:

I want to generate a random number between 1 to 10 but when i use

import random
for x in range(10):
  print random.randint(1,10)

The output says

print random.randint(1,10)
SyntaxError: invalid syntax

Why wont it work?




Aucun commentaire:

Enregistrer un commentaire