call a def in python code example
Example 1: how to define function in python
def example():
print("Example.")
example()
Example 2: how to call a function in python
def func():
print(" to write statement here and call by a function ")
func()
// Returns
Example 3: explain def in python
def greet(name):
"""
This function greets to
the person passed in as
a parameter
"""
print("Hello, " + name + ". Good morning!")
Example 4: 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()