Skip to content
Sign upLog in
← Back to Community

def function in python

Profile icon
Rocking-Rayquaza

can anyone help me with def function in python ??
i have searched on web but couldn't understand properly so please help...

Answered by CoolJames1610 [earned 5 cycles]
View Answer
Voters
Profile icon
nimaytiwari
Profile icon
FienvanEngelen
Profile icon
Rocking-Rayquaza
Comments
hotnewtop
Profile icon
CoolJames1610

i can help you, what is the problem?

Profile icon
Rocking-Rayquaza

@CoolJames1610
I just want to detailed with some sort of example which could be understood as i am a begginer to python

Profile icon
CoolJames1610

Okay here

@ROCKINGRAYQUAZA

def say_hello(name): print("Hello " + name) say_hello("CoolJames") #"CoolJames" is the parameter that you want to pass into say_hello and the say_hello function will exceute (Hello CoolJames) say_hello(input("What is your name? ")) #What ever the user inputs will act as the parameter, so if I typed in James, the program will output "Hello James" # Note that functions have the be defined before you can use them. e.g. ''' say_hello("Bob") def say_hello(name): WRONG def say_hello(name) say_hello("Bob") RIGHT '''

Hope this helped. If you want any more help please say :)

If this answer helped please mark it :D

Profile icon
Rocking-Rayquaza

just one more how can i find you again on repl.it

Profile icon
CoolJames1610
Profile icon
Rocking-Rayquaza

how can i find you again on repl.it if i have any further queries [email protected]

Profile icon
Rocking-Rayquaza

@CoolJames1610
how do you make such cool programs ,they are mind blowing

Profile icon
Rocking-Rayquaza

@CoolJames1610
please check one of my programs too.
https://repl.it/@ROCKINGRAYQUAZA/game10

Profile icon
CoolJames1610
Profile icon
CoolJames1610
Profile icon
Rocking-Rayquaza

plz tell how you those awesome programs


@ROCKINGRAYQUAZA