Ok, im learning python so i tried to make my own script..

i did numbers that you could choose instead of letters, how can i do this with letters? cuse n== “a” doesnt work, nor does n == a

enn0x I hope they have updated that from the edition I printed out and read in 2002. Because it was badly written back then. NOT at ALL for beginners. It was more geared toward people that already knew programming in some other language and were trying to learn the particularities of python.

@Andreas:
i just had a quite long text inside this textbox here, but i erased it and wrote it again, because of the agressive tone. i even erased the new one, because so many others already tried to tell you what to do that way.

just try to remind this simple rule every time you feel like posting anything in the future:
Read The (Fine) Manual!
you have more than enaugh sources and tips. please make use of them, instead of annoying us. please!

This is because ‘input’ is the wrong method, both for numbers and for strings. Please read the Python documentation on the methods ‘input’ and ‘input_raw’.

I have been wrong with my first post. Don’t start with ‘Dive into Python’ or the official Python tutorial (which is written very good, back from 1999 when I first read it up to now, including the year 2002). Start with a text on how to learn programming. This one looks good. A lot of time is spent on explaining things like variables, expressions (that’s what the method ‘input’ expects - a valid Python expression!) and so on.

http://www.pasteur.fr/formation/infobio/python/

enn0x

but dive in is for those who already have programed in some language before
And im a very good programmer in LUA in roblox.
Nemesis, i AM readying the manual!
and all i do is ask questions about stuffs i dont understand, but i dont seem to get so many answers, more of suggestions about new manuals and so on.

So: Should i ask for things i dont understand and things they dont explain well in the manual here or not?

Its like, i ask one questions and nemesis comes and say RTFM and everyone else spamms with things like: You should read the “ashabala” manual…
Im sticking with dive into python just answer the question please…

Question:

Answer:
“input” is the wrong method. Use “raw_input” instead. “input” expected the user to enter valid Python expressions which is evaluated by “input”, and the result is returned. “raw_input” just waits until the user has typed something and then returns the input as a string.

That you script has been working with number has been pure luck, since a Python expression containing a number evaluate to a number. This is what you get when you enter a letter:

List of math carculations:
1: Add
2:Substract
3:Double
4:Devide
Chose a number: 1
Type a Number: a
Traceback (most recent call last):
  File "C:\Users\rpf\Desktop\test.py", line 33, in <module>
    Add()
  File "C:\Users\rpf\Desktop\test.py", line 7, in Add
    n = input("Type a Number: ")
  File "<string>", line 1, in <module>
NameError: name 'a' is not defined
shell returned 1

Python works perfectly here. The Python interpreter detects that you (the user) has entered an invalid Python expression (let me repeat: “input” expected a valid Python expression - cited from the Python manuals!), and then the Python interpreter even tells you what you have done wrong. Quite generous in my opionion, and something you don’t get in other languages like C++.

Since you are a very good LUA programmer you know the difference between expression and string, or between variable and string. It’s the same as in LUA. If not: look at the spam above.

enn0x

actually i learned Lua by first modding scripts and then asking why they dident work XD
So i never learned that…
But since people talk about those things ofthen at the forum i snapped up some stuffs:
variable = number that can be changed
string = anything inside the two “”
expression = no clue, never heard except when they mention that in the manuals…
float = endless values like pi?

and my script is counting on that the person using it have IQ enough to type a number when they are suppose to XD

ok now i changed that to raw and made my n == 1 (for ex) to strings
Everything works, Thanks about that raw thingy!

can you help:how can i get ma panda 3d scrip i need it?

ahm. first off. please don highjack threads.
for your question. if you need a panda3d script. you have to write it yourself. you need to know how to program python for that.
we can help you if you hit a specific problem.

greetings,
thomas

ps: seriously… is anyone reading the first page of a manual, or the sticky threads, or the describtion what panda3d is, or what you need or even this thread?.. not that i’m a nasty guy as such but i feel like i’m repeating myself for about 4 or 5 days now so i’m just wondering…