From: Alan Gauld
Date: 02/18/06 18:00:09
To: Kermit Rose; Danny Yoo
Cc: Tutor
Subject: Re: [Tutor] Need to write a python and call it within a python mainprogram (fwd)
?
Indentation is how python determines block sytructure.
In Python a colon says a block is coming up and
> Using it, I translate my pseudo code
> into
>>> def trans01(a,b,c,d):
j = 8 * a%2 + 4 * b%2 + 2 * c%2 + d%2
if j = 0, a,b,c,d = a/2,b/2,c/2,d/2
if j = 1, a,b,c,d = -1,-1,-1,-1
if j = 2, a,b,c,d = a,b/2,c,d/2
IndentationError: expected an indented block (, line
> I know how to write functions in Fortran.
>
> Please help me with the syntax. I don't know how to tell python to run a
> main program and use subroutines.
OK, Now we have some specifics.
First to make a program run just create a text file and use an
extension of .py, for example myprogram.py