Beginner trying to understand functions.

Peter Otten __peter__ at web.de
Mon Dec 8 15:46:07 CET 2008


James Mills wrote:

> On Tue, Dec 9, 2008 at 12:24 AM, cadmuxe <cadmuxe at gmail.com> wrote:
>> i think we should use raw_input('Please enter your name: ') instead of
>> input('Please enter your name: ')
> 
> Good point :) OP: Please take notes :)

I think the OP is using Python 3.0. What used to cause trouble

Python 2.5.1 (r251:54863, Jul 31 2008, 23:17:43)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> input()
1/0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 1, in <module>
ZeroDivisionError: integer division or modulo by zero

is now the way it should be:

Python 3.0 (r30:67503, Dec  4 2008, 11:26:28)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> raw_input()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'raw_input' is not defined
>>> input()
1/0
'1/0'

Peter



More information about the Python-list mailing list