functions and variable scope Flashcards
1
Q
what are functions
A
returns a value
2
Q
what are procedures
A
doesnt return a value
3
Q
what are methods
A
belong to an object
4
Q
how to make a subprogram
A
eg. def myProgram():
for i in range (0,11):
print(i)
counter = input(“would you like to count to 10? “)
if counter == “yes”:
myProgram()
print(“here you go”)
else:
print(“alright”)
the myProgram() will already call a program for us as it is an already made subprogram