Answers for "where to define functions in python"

1

how to create a function in python

#to create a function in python, do the following

#create func
def func(): #can add variables inside the brackets
  print("This is the function of the func")
  
# to call a function, do the following
func()

#you would get a line of code saying "This is the function of the func"
Posted by: Guest on December-23-2021
0

function used in python

def hello():
  name = str(input("Enter your name: "))
  if name:
    print ("Hello " + str(name))
  else:
    print("Hello World") 
  return 
  
hello()
Posted by: Guest on February-10-2021

Code answers related to "where to define functions in python"

Python Answers by Framework

Browse Popular Code Answers by Language