<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1476" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT color=#000080>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000>Hello 
list!</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT 
color=#000000></FONT>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000>I&nbsp;have 
started teaching Python to a group of High School students. I set them the 
"Guess the Number" game as a GUI as an assignment. One of the students has 
passed in some script that is foreign to any tutorial work we have done.&nbsp; 
Some of it is below. Does anyone recognise it? Can you tell me where it would 
have been downloaded from? I have searched for scripted guess the number games, 
but there are thousands of them - except for a Python version. </FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT 
color=#000000></FONT>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000>If my student 
has plagiarised - I need to know.</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT 
color=#000000></FONT>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000>TIA 
Diana</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT 
color=#000000></FONT>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT 
color=#000000></FONT>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000>from Tkinter 
import *</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000>from whrandom 
import *</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT 
color=#000000>&nbsp;<?xml:namespace prefix = o ns = 
"urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT 
color=#000000>&nbsp;<o:p></o:p></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000>class rand: 
</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>def __init__(self, low, 
high):<SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>#whrandom number is 
made here</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>self.ro = 
whrandom()</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>self.num = 
self.ro.randint(low, high)</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT 
color=#000000>&nbsp;<o:p></o:p></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>def number(self):<SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>return 
self.num</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT 
color=#000000>&nbsp;<o:p></o:p></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>def set(self):<SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>self.num = 
self.ro.randint(low, high)</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT 
color=#000000>&nbsp;<o:p></o:p></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000>#this part 
evaluates the users guess</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000>def 
evaluate_ans(guess_str, whrandom, low_str, high_str, guess_left, \</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>guess_eval_str, yg_label):</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>guesses_left = 
int(guess_left.get())<SPAN style="mso-spacerun: yes">&nbsp;&nbsp; 
</SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>guesses_left = guesses_left - 
1</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp; 
</SPAN>guess_left.set(str(guesses_left))</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>guess = 
int(guess_str.get())</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>if guess == 
whrandom.number():<SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>#User has guessed the number.</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>guess_eval_str.set("correct")</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>play_agn.configure(state=NORMAL)</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>else:<SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>#User has not guessed the number.</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>if guess &lt; 
whrandom.number():<SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>#Guess is too low.</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>low_str.set(str(guess))</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>guess_eval_str.set("too low")</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>elif guess &gt; 
whrandom.number():<SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>#Guess is too high.</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>high_str.set(str(guess))</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>guess_eval_str.set("too high")</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>guess_str.set("")</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>if guesses_left 
== 0:<SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>#User has no guesses left.</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>yg_label.configure(text="Correct answer:")</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>guess_eval_str.set(str(whrandom.number()))</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>play_agn.configure(state=NORMAL)</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>return</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT 
color=#000000>&nbsp;<o:p></o:p></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000>#Reset 
variables for next game</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000>def 
reset(whrandom,play_agn, low_str, high_str, guess_left, guess_str, \</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>yg_label, guess_eval_str, low, high):</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp; 
</SPAN>play_agn.configure(state=DISABLED)</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>whrandom.set()</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>low_str.set(str(low - 
1))</FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN 
style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>high_str.set(str(high + 
1))</FONT></P></FONT></DIV></BODY></HTML>