[Tutor] a neewbie at python

Alan Gauld alan.gauld@blueyonder.co.uk
Thu May 8 16:23:02 2003


> +,%,/,* and -. The example our lecturer gave was that if we run our
> programme as python "name of programme" 23.4 + 17.5
>  the output shoud be 40.9.
>
> I have no idea what to do so can you please advise me guys

Well we don't do homework here but I can give you some pointers.

You might like to read my python tutor section on "Talking to the
User",
particularly the part on command line arguments.

Also to parse the numbers etc you migt want to look at the
string functions such as split, and concepts such as "slicing".
These are all covered in my tutor and, in much more detail,
in the python documentation.

And one last hint, look at the "in" test, as in:

if c in "+-*/=":
   # do something

HTH, Have a go, if it doesn't work come back here and ask us
some specific questions and we'll try to unravel it for you.

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld