[Tutor] Tutor Digest, Vol 118, Issue 62

Keith Winston keithwins at gmail.com
Sat Dec 14 05:25:28 CET 2013


>
> Message: 6
> Date: Thu, 12 Dec 2013 23:10:31 -0500
> From: Sky blaze <skyblaze101 at gmail.com>
> To: tutor at python.org
> Subject: [Tutor] Coding for a Secret Message in a Game
>


> it'd be amusing to have the message change after the player types something
> other than "start" at least 10 times. I've attempted numerous times to code
> this, but all of them have failed. Could you help me with the coding? It
> should look something like this in the end:
>


> while start != True: #Infinite loop that doesn't end until "start" is typed
>     if start_prompt == "start":
>         start = True #Continues from the title screen
>     else:
>         #This is where I'm stuck. I can loop it so it always returns the
> command message when
>         #"start" isn't typed, but changing the message upon having that
> occur at least 10 times is
>         #what's giving me trouble
>

Probably smarter people than I will have better ideas, but if you make your
else an elif and use an expression something like
*** counter = 0 # somewhere before the while
elif counter < 10:
    counter += 1
    print("type start")
else
    print("just do it")
that should (roughly) do it, unless I'm misunderstanding. Good luck!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20131213/18d76856/attachment.html>


More information about the Tutor mailing list