[Tutor] Inputting elements of a list
Bob Gailer
bgailer at alum.rpi.edu
Tue Jan 23 04:43:38 CET 2007
Luke Paireepinart wrote:
> vanam wrote:
>
>> For standard input from the keyboard raw_input will be used for string
>> and input for number.Suppose i want to input a list of some elements
>> how could it be done. Actually i am looking for sorting out elements
>> in a list.Below is the given script
>> list = [45,4,5]
>> list.sort()
>>
>
> Don't call your lists 'list', or a character 'chr' or an int 'int'...
> These are all reserved keywords in Python
actually they are built-in functions / types. Reserved words (for, if,
def, ....) can't be used for anything else.
> and if you use them as
> variables you'll overwrite the builtins in that scope.
> Example:
>
> >>> int = 1
> >>> int('1000')
> Traceback (most recent call last):
> File "<pyshell#5>", line 1, in ?
> int('1000')
> TypeError: 'int' object is not callable
>
>
> HTH,
> -Luke
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
--
Bob Gailer
510-978-4454
More information about the Tutor
mailing list