<br><div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br> It all works up until I need to print five randomly chosen numbers from<br> the range [1,n]. It tells me that random is not defined.</blockquote>
<div><br>You need to put :<br>import random<br><br>in your program before doing: 
y = random.randrange(1,n)<br><br>or alternatively use:<br>from random import *<br><br>and call the function as follows:<br>
y = randrange(1,n)<br><br>Regards, <br></div></div><br>-- <br>Michael Connors<br>