functions and variable scope Flashcards

1
Q

what are functions

A

returns a value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what are procedures

A

doesnt return a value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what are methods

A

belong to an object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly