Reputation: 11
Whenever I write a function and then run it in the Shell, it comes up blank. I have only been programming for about a month so don't make things very difficult.
My code looks like this:
def intro():
print("hello world")
Then when I run it, it . No air message pops up. Except in my code the 2 lines are touching
Upvotes: 1
Views: 3398
Reputation: 4219
You need to call your function! Do this with intro()
after the function is defined (Hugh has a nice example above my answer). Better read up on some basics first ;) Codeacademy has an awesome Python course if you're interested.
Upvotes: 0
Reputation: 56654
You wrote a function; now you have to tell it to run the function!
Try
def intro(): # <= this tells Python what "intro" means
print("hello, world")
intro() # <= this tells Python to actually do it
Upvotes: 6