Python Random Numbers

Main.PythonRandomNumbers History

Hide minor edits - Show changes to markup

May 03, 2007, at 08:13 PM EST by verbal -
Changed line 4 from:
  1. rando.py
to:
  1. rando.py by Verbal
May 03, 2007, at 08:12 PM EST by verbal -
Added lines 1-14:
#!/usr/bin/python
#
#  rando.py
#  print a list of 10 random numbers consisting of numbers 1 - 100
#
import random
loopval =  0
while loopval < 10 :
  n = random.randint(1,100)
  ans = "%2d   %4d" % ( loopval + 1, n)
  print ans
  loopval = loopval + 1