[Tutor] Need to write a python and call it within a python main program (fwd)

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Sat Feb 18 21:04:11 CET 2006



---------- Forwarded message ----------
Date: Sat, 18 Feb 2006 15:02:47 -0500 (Eastern Standard Time)
From: Kermit Rose <kermit at polaris.net>
To: Danny Yoo <dyoo at hkn.eecs.berkeley.edu>
Subject: Re: [Tutor] Need to write a python and call it within a python
    main program




From: Danny Yoo
Date: 02/18/06 14:44:20
To: Kermit Rose
Cc: tutor at python.org
Subject: Re: [Tutor] Need to write a python and call it within a python main
program

>
> I need to write a function that modifies its 4 imput values,
> a,b,c,d according to the following rules.

[program description cut]

> I also need to find out how to write the main program that calls this
> function repeatedly, testing the output values for the solution to the
> equation.

Hi Kermit,

.... this looks like a crazy program, but oh well.  *grin*

So... what do you need help on?

*******

I need help on the SYNTAX of Python

I have programming experience in Fortran and a little bit of C.

********

I mean this in all seriousness: you have to tell us what you're having
trouble with, because otherwise, we can't do much.  We want to help you so
that you can write your program, but we don't want to write the program
for you, as this looks way too close to some homework problem (even if it
looks absolutely bizarre to me.)

****************

Right.  I understand the prohibition against doing student's homework for
them.

I don't know how to get started.

I've downloaded Python, and have used the idle as a desk calculator, but do
not yet
know how to write programs in it.


******
Do you already have programming experience in another language?  Do you
already know how to write functions?

*********************

I do not know how to write functions in Python.

I know how to write functions in Fortran.

******************


 Do you already know about
conditionals?


*******************

I know about the == relational operator.

***************


Do you know how to test a function?


*************************

Do you mean
(1)  call the function with test values to see if it performs the way you
want it to?
(2)  something else that is Python related that I know nothing about?

*********************


I really can't
pinpoint what problems you have yet, so you're going to have to tell us
more.

**********************

Yes.   I will do the best I can.

*****************

If you don't have programming experience yet, the tutorials at:

    http://wiki.python.org/moin/BeginnersGuide
    http://wiki.python.org/moin/BeginnersGuide/NonProgrammers

may be helpful to you.

********

Thanks.  I have downloaded the second one.  The first one looked very useful
also,
but I would like it to have more examples.

Please help me with the syntax.   I don't know how to tell python to run a
main program and
use subroutines.   I don't know how to make those subroutines available to
the main program.


Kermit   <  kermit at polaris.net  >



More information about the Tutor mailing list