Python Programming Tutorial - 27 - Building Functions
Loading...
55,759
Loading...
Top Comments
see all
All Comments (131)
-
can't we use a variable as an input?
-
>>> def hello(x): print "Hey there " + x
>>> print hello("Dom")
Hey there Dom
None
>>> print hello ('Dom')
Hey there Dom
None
>>>
why is it saying none?
-
@NukaColaQuantumVault actually, in python 3x you don't really need to use the print, you just need to call the function, like that: whatsup("Alex") like other functions that we call...then python will return the result.
-
can i use python with udk and 3ds max?
-
hey my name is tony you noob
-
@TeamINSTINKED A free " C Dos, C Dos Run" T-Shirt, postage not covered though :/
-
why didnt you use "print" statement ? in which tutorial you used the "return" statement?
-
@1994taxman 1 dislike :(
-
Hahaaa I was the 50,000th view wot do I get ??????
Loading...
@1Moonwalker when u save the file put ".py" after the file name and colors will come back :)
uratoko 8 months ago 11
If you try to use what Bucky did here in Python 3x+, you will get this.
>>> def whatsup(x): return 'Whats up ' + x
>>> print whatsup ('Alex?')
SyntaxError: invalid syntax
To fix this, you need the syntax form as shown below.
>>> print (whatsup('Alex?'))
Then Python will echo.
NukaColaQuantumVault 1 year ago 8