[Tutor] Repeat Until Dead

Danilo Chilene bicofino at gmail.com
Thu Jun 27 00:07:33 CEST 2013


Hello,

Try something like this:

coin = raw_input('Insert coins:\n')

while(coin > 0):
    coin = int(coin)-1
    print 'You have {0} coin(s)'.format(coin)

$ python teste.py
Insert coins:
2
You have 1 coin(s)
You have 0 coin(s)



On Wed, Jun 26, 2013 at 3:30 PM, Chris “Kwpolska” Warrick <
kwpolska at gmail.com> wrote:

> On Wed, Jun 26, 2013 at 8:23 PM, Jack Little <jacklittlemc at yahoo.com>
> wrote:
> > In a combat system, how would I have a certain raw_input repeat until the
> > enemy is dead?
> >
> >
> > Thanks a ton,
> > Jack
>
> Something like this:
>
> while enemyalive:
>     raw_input('Action? ')
>
> --
> Kwpolska <http://kwpolska.tk> | GPG KEY: 5EAAEA16
> stop html mail                | always bottom-post
> http://asciiribbon.org        | http://caliburn.nl/topposting.html
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130626/c1e62f2d/attachment.html>


More information about the Tutor mailing list