[Tutor] declare-define

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Fri Oct 15 20:22:13 CEST 2004

On Fri, 15 Oct 2004, nitt wrote:

> Hi All'
>     Trying to get the following, and yes,tried most everything.
> input("p(1)=")
> input("p(1)=")
> input("p(3)=")

Hi Nitt,

Ah!  The problem here is that input() actually knows nothing about the
string prompt that you're giving it.  What I mean is that we could have
easily have written:

    input("The first value of the p variable:")


    input("Give me something to input:")

Python will print out the input, but it basically doesn't try to
understand what the prompt means.  input() is not smart enough to
interpret English.  *grin*

So you need to tell it to store the result of the input() into the target
variable in an explicit way.  For example:

    p1 = input("please enter p1")


    p1 = input("p(1)=")

Does this make sense?

> print int(a) rjust(45)
> Keep getting name error,p() not defined and rjust doesn't exist.

What is rjust()?  Which tutorial or documentation are you looking at?

Best of wishes to you!

More information about the Tutor mailing list