Download presentation
Presentation is loading. Please wait.
1
Topic: Where to put functions in a program
CMPT 120 Topic: Where to put functions in a program
2
Where to put functions in our Python program
Header comment block + import statement(s) # Header Comment Block # Function 1 … Function definitions # Function n # Main part of my program The main part of my program
3
Function call –> situation 1
Python program Header comment block + import statement(s) # Header Comment Block # Function Function definition # Main part of my program Function is called The main part of my program
4
Function call –> situation 2
Python program Header comment block + import statement(s) # Header Comment Block # Function 1 Function definitions # Function 2 # Main part of my program Function 1 is called The main part of my program Function 2 is called
5
Function call –> situation 3
Python program Header comment block + import statement(s) # Header Comment Block # Function 1 Function definitions # Function 2 Function 1 is called # Main part of my program The main part of my program Function 2 is called
6
Function call -> Would this situation work?
Python program # Header Comment Block Header comment block + import statement(s) # Function 1 Function definition # Main part of my program Function 1 is called The main part of my program Function 2 is called # Function 2 Function definition
7
Function call –> Would this situation work?
Python program Header comment block + import statement(s) # Header Comment Block # Function 1 Function 2 is called Function definitions # Function 2 # Main part of my program The main part of my program Function 1 is called
8
Where to put functions in our Python program – Not a good idea!
Header comment block + import statement(s) # Header Comment Block # Main part of my program The main part of my program # Function 1 Function definitions # Function 2
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.