Code basics

Fredrik Lundh effbot at telia.com
Fri Mar 17 10:48:10 EST 2000


JJ <joacim at home.se> wrote:
> I'm a C/C++/Java programmer and wonder how to make "code blocks" in
Python.
>
> Please translate this to Python:
>
> while( notDone )
> {
>     int chip = this.getNumberOfSomething();
>     if (chip == 10 )
>     {
>         System.out.println("Tjohoo");
>     }
>     else
>     {
>         System.out.println("Oh no!");
>     }
> }

hint: it's 6 lines in Python.  reading chapters 3 and 4
of the tutorial will help you figure out what they look
like:

http://www.python.org/doc/current/tut/tut.html

</F>





More information about the Python-list mailing list