[Tutor] New to programming and python first minimilistic program (Bottles of beer), , please comment!

vince spicer vinces1979 at gmail.com
Wed Jun 17 23:01:45 CEST 2009


Like in any language there any number for ways, heres another

b = "bottles of beer"
w = "on the wall"
bottles = range(1, 101)
bottles.reverse()
for bottle in bottles:
    print " %s %s %s if one of those bottles should happen to fall there'll
be %s %s %s" % (bottle, b,w, bottle-1, b,w)

Vince

2009/6/17 matthew andriani <skellem2003 at hotmail.com>

>  Hi Guys,
>
> I wrote this program for some practice to get into python..I'm trying to
> find fun ways to learn the language so if anyone has a challenge on this
> basic level using loops that sounds exciting please let me know.. If you
> think this program can be improved please let me know too :)
>
> b = "bottles of beer"
> w = "on the wall"
> a = 100
> while a != 0:
>     a = a-1
>     print a,b,w,a,b,"if one of those bottles should happen to fall there'll
> be",a-1,b,w
>
>
> Thanks for the feedback..
>
> Cheers,
> Skellem.
>
>
>
> ------------------------------
> What can you do with the new Windows Live? Find out<http://www.microsoft.com/windows/windowslive/default.aspx>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090617/1678eb88/attachment-0001.htm>


More information about the Tutor mailing list