<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hey all,<div><br></div><div>I'm trying to write a def that has a check to see if the entered information is within a pre-determined valid set.</div><div>Below is what I have so far but it doesn't seem to be working properly.</div><div>What I want is to have the user be able to enter 1 through 8 and have the information pass fine but anything else would cause the user to repeat the process.&nbsp;</div><div>I'm using a while loop to try to do this. The only other thing I can think of to do is incorporate a list and see if I can check the list to complete this.</div><div><br></div><div>Any assistance would be greatly appreciated.</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span style="color: #2c26f9">def</span> getUserSkillLvl(GameType): #GameType is an in of 8 or 9 passed to this def based on previous input</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; temp = <span style="color: #920a09">0</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; <span style="color: #2c26f9">while</span> temp == <span style="color: #920a09">0</span>:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #2c26f9">if</span> GameType == <span style="color: #920a09">8</span>:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UserSkillLvl = raw_input(<span style="color: #00b626">"Enter your current skill level: "</span>)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int(UserSkillLvl)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #2c26f9">if</span> ((UserSkillLvl &lt;= <span style="color: #920a09">8</span>) <span style="color: #2c26f9">and</span> (UserSkillLvl &gt;=<span style="color: #920a09">1</span>)):</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #2c26f9">print</span> <span style="color: #00b626">"thank you"</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp = <span style="color: #920a09">1</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #2c26f9">break</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #2c26f9">elif</span> (UserSkillLvl &gt;<span style="color: #920a09">8</span>) <span style="color: #2c26f9">or</span> (UserSkillLvl &lt; <span style="color: #920a09">1</span>):</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #2c26f9">while</span> temp == <span style="color: #920a09">0</span>:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UserSkillLvl = raw_input(<span style="color: #00b626">"Please re-enter your skill level: "</span>)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; <span style="color: #2c26f9">return</span> UserSkillLvl</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><br></div><div>
Best,<br><br>Mike Nickey<br><a href="mailto:mnickey@gmail.com">mnickey@gmail.com</a><br></div>
<br></div></body></html>