vendredi 20 novembre 2015

import random isn't working (I think)

I'm very new to Python (first year university student) and while attempting to finish some homework, I ran into a problem. I'm creating a very simple program using random numbers. Here is what I've written so far:

import random

def main():
  print random.randint(2,10)
  a=random.seed()
  b=random.seed(5)
  c=random.seed(5)
  print (a)
  print (b)
  print (c)

The problem is that it always prints NONE for a, b, and c. For random.int, it always prints the lowest integer I enter (2 in this case). So this basically makes it impossible for me to write the actual program (a random candy dispenser). I'm actually just assuming that 'import random' isn't working. I actually have no clue.

I would normally ask my professor about this, but he can't be reached until Monday and this assignment is due tonight. Any help is greatly appreciated, and I apologize for the sheer amateurishness of this post.




Aucun commentaire:

Enregistrer un commentaire