def white():
print
print ("First line")
white()
print ("Second line")
This is one of my first scripts. When I press the "F5" key, this is the result:
First line
Second line
Where is the mistake?
You are using Python 3 in which print is a function. In Python 2 print is a statement and your code would behave as you expect.
This line:
print
does not call the function. It merely looks up the name print. And that does not result in anything being place on the output device.
You presumably meant to write something like this that actually calls the function:
def white():
print()
print ("First line")
white()
print ("Second line")
Output
First line Second line
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With