[Chicago] pedantic guessing game demo
kirby urner
kirby.urner at gmail.com
Sun Mar 27 00:53:45 CET 2011
On Sat, Mar 26, 2011 at 4:05 PM, Malcolm Newsome
<malcolm.newsome at gmail.com> wrote:
> Thanks Brian. That's precisely what I needed!
>
> Malcolm
>
>
>
> On Sat, Mar 26, 2011 at 4:40 PM, Brian Ray <brianhray at gmail.com> wrote:
>>
>> Fun... One comment on:
>>
And then if the real goal is to teach programming (more than to play
this little
guessing game) a next step would be to challenge a learner to modify
it slightly
to where it says "Too high" or "Too low" on any guess that's not right.**
Another challenge would be to come up with several variants of this program
the exercise different features, even try: / except: if you wanna get creative.
Python rocks, party on!
Kirby
** PSF chairman Holden uses just this approach in his courseware for OST.
>>> print "I'm thinking of a number between 1 - 100. Can you guess what
>>> it is?"
>>>
>>>
>>> random_num = random.randint(1, 100)
>>>
>>> guess = int(input("Type a number between 1 - 100: "))
>>>
More information about the Chicago
mailing list