0
Q:

what is def in python

def example():			#This defines it
  print("Example.")		#This is the defined commands

example()				#And this is the commands being run
17
def name_function(parameter list):
      instruction block
6
def myFunction():
  print('I am running in a function!')
14
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(fname, lname):
  print(fname + " " + lname)


  my_function("Emil", "Refsnes") 
3
x ="world"

def myfunc():
    global x
    x ="hello"
myfunc()
print(x)

0
for i in range(3):
    scores = int(input("Enter scores: ")
    test = scores / 3
print "Total average grade: " + str(test)        
-2

New to Communities?

Join the community