The definition of parameters?
What is variable used to send information to a function.
Print and input
What is Subprogram
def adder (a, b = 0, c = 0): print (a + b + c) #Main x = 6 y = 9 adder (5) adder ( 3, 6) adder ( 1, 2, 3)
5
9
6
What is the definition of method/function/subprogram?
What is a collection of commands given a name.
Main function?
The central part of the program
def average(a, b, c):
print( 1.0*(a + b + c)/3)
#MAIN
n1 = int(input ("First number: "))
n2 = int(input ("Second number: "))
n3 = int(input ("Third number: "))
average(n1, n2, n3)
if the numbers are 10, 20, 30
20.0
What is the definition of Main program?
What is The central part of the program.
What does "def" do?
What is Stands for define/ creates a method
def example ():
print ("Code in the SubProgram")
# ******* MAIN *******
print ("Code in Main")
example()
Code in Main
Code in the SubProgram
Def score (a,b = 10) b is a ________ parameter.
What is optional?
What is the primary use of functions?
What is To organize longer programs.
##Subprogram
def Mskay ():
print("Computer science rocks!")
##Main Program
Mskay()
#call on the "play"
Computer science rocks!