Debashish Saha wrote:
*PROGRAM TO FIND FACTORIAL OF A NUMBER(I HAVE WRITTEN IT ON GEDIT)*
This program is irrelevant. Your question has nothing to do with factorial of
numbers. It is about getting input from the user. As you ask:
HOW TO ASK INPUT FROM USER THEN?
The answer is:
Do not use input, as it is dangerous and should not used. Use raw_input instead.
py> answer = raw_input("what is your name? ")
what is your name? Steven
py> print answer
Steven
This works fine. See if you can work out what is going on here, and understand
why I say input is dangerous and should be avoided:
py> answer = input("what is your name? ")
what is your name? Steven
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 1, in <module>
NameError: name 'Steven' is not defined
--
Steven
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor