rick
0
Q:

how to call a function in python

def test_function(argument1,argument2,argument3) :
  # Do something with the code, and the arguments.
  print(argument1)
  print(argument2)
  print(argument3)
  
# Calling the function.

test_function('Hello','World','!')

# Output
'''
Hello
World
!
'''
11
def example():			#This defines it
  print("Example.")		#This is the defined commands

example()				#And this is the commands being run
17
def myFunction(say): #you can add variables to the function
  print(say)

myFunction("Hello")

age = input("How old are you?")

myFunction("You are {} years old!".format(age))

#this is what you get:

Hello
How old are you?
>>11 #lol my real age actually
You are 11 years old!
18
def myFunction():
  print('I am running in a function!')
14
def func():
  print(" to write statement  here  and call by a function ")
  
func()
// Returns 
1
def function():
  print('This is a basic function')
  
function()
// Returns 'This is a basic function'

def add(numA, numB):
  print(numA+numB)
  
add(1,2)
// Returns 3

def define(value):
  return value

example = define('Lorem ipsum')
print(example)
// Returns 'Lorem ipsum'

6
def functionName(variable):
  //function content
7
def nameOfFunction(something):
  	return something
6
def my_function(a,b=1,c=2,verbose=True):
  x=a+b+c
  if verbose:
    print('Just wanted to tell you x=%d' %x)
  return x

n=my_function(3)
4

  def my_function(fname, lname):
  print(fname + " " + lname)


  my_function("Emil", "Refsnes") 
3

New to Communities?

Join the community