how to run a def function in python code example
Example 1: how to make a function in python
def test_function(argument1,argument2,argument3) :
print(argument1)
print(argument2)
print(argument3)
test_function('Hello','World','!')
'''
Hello
World
!
'''
Example 2: how to define function in python
def example():
print("Example.")
example()
Example 3: how to call a function in python
def func():
print(" to write statement here and call by a function ")
func()
// Returns
Example 4: how to use def in python
def functionName(variable):
//function content
Example 5: what does * mean in python in functions
>>> numbers = [2, 1, 3, 4, 7]
>>> more_numbers = [*numbers, 11, 18]
>>> print(*more_numbers, sep=', ')
2, 1, 3, 4, 7, 11, 18
Example 6: python def
def paste(a, b)
for i in b:
print(a)
while True:
paste("Python is Cool!!!", 3)
happy = "NEUTRAL"
def yes():
happy="TRUE"
print("Thank you!")
def no():
happy="FALSE"
print("That's not nice!")
answer=str(input("Do you like my new shoes? (y/n) ")
if answer=="yes" or "y" or "Yes" or "Y" or "YES":
yes()
elif answer=="no" or "n" or "No" or "N" or "NO":
no()