Apr 15, 2006
56,640
Code:
>>> 'hello world'
'hello world'
>>> print "hello world"
SyntaxError: invalid syntax (<pyshell#1>, line 1)
>>> "Hello World"
'Hello World'
>>> "none"
'none'
>>> x=0
>>> y=1
>>> y/x
Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    y/x
ZeroDivisionError: int division or modulo by zero
>>> x/y
0.0
>>> "2+1"
'2+1'
>>>[
EDIT: yes martin, i typed them! :D
 
Apr 15, 2006
56,640
martin... more results...

Code:
>>> print
<built-in function print>
>>> print x
SyntaxError: invalid syntax (<pyshell#10>, line 1)
>>> print (x)
0
>>> print("hello world")
hello world
>>> print 'hello world'
SyntaxError: invalid syntax (<pyshell#13>, line 1)
>>>
 

Martin

Senior Member
Dec 31, 2000
56,913
Code:
>>> 'hello world'
'hello world'
>>> print "hello world"
SyntaxError: invalid syntax (<pyshell#1>, line 1)
>>> "Hello World"
'Hello World'
>>> "none"
'none'
>>> x=0
>>> y=1
>>> y/x
Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    y/x
ZeroDivisionError: int division or modulo by zero
>>> x/y
0.0
>>> "2+1"
'2+1'
>>>[
EDIT: yes martin, i typed them! :D
:shifty:

everything is correct apart from the weird print error
 

Martin

Senior Member
Dec 31, 2000
56,913
martin... more results...

Code:
>>> print
<built-in function print>
>>> print x
SyntaxError: invalid syntax (<pyshell#10>, line 1)
>>> print (x)
0
>>> print("hello world")
hello world
>>> print 'hello world'
SyntaxError: invalid syntax (<pyshell#13>, line 1)
>>>
Aaaaaaaaah, I see what happened. I guess you installed python 3.0 instead of 2.6. It's cool though. You see, in 3.0 it's no longer legal to say
print "Hello World"
the argument has to be in paranthesis, because print is a function.
 

Martin

Senior Member
Dec 31, 2000
56,913
How dare you call God an infidel.



Tempting...

I've disliked coding ever since the pish I had to do in 3rd and 4th year at secondary school.
Programming is usually taught really really badly. Makes some people hate it, which is understandable. What they should be teaching is stuff like Python, that actually makes you like it.
 
Apr 15, 2006
56,640
Aaaaaaaaah, I see what happened. I guess you installed python 3.0 instead of 2.6. It's cool though. You see, in 3.0 it's no longer legal to say
print "Hello World"
the argument has to be in paranthesis, because print is a function.
Aah.. i see. yes i've installed 3.0. i aint gonna crib about parenthesis!


@Red: God is just an imaginary friend. Love Me, and i shall set you free!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 657)