Uploaded March 2022 | Updated November 2026, 3 hours ago
This is the 16th in a course of computer science video lessons introducing programming with Python. This lesson introduces sub procedures. When you are writing applications, it is good practice to avoid long repetitive programs. Sub programs like sub procedures and functions make this possible. In this lesson you will learn how to define and call a sub procedure, as well as reviewing some concepts you met in previous lessons. You will learn how a sub procedure can be defined, either within the same file as the calling program, or inside a separate file. You will also learn how to use the import keyword to make sub procedures in an external file available to a calling program.
Chapters:
00:00 Why you should use sub programs
00:41 Review – a simple calculator
03:20 Sub procedure code
06:45 Define a sub procedure with the def keyword
09:32 Define a sub procedure in a separate file
09:49 Import procedures from an external file
This is the 16th in a course of computer science video lessons introducing programming with Python. This lesson introduces sub procedures. When you are writing applications, it is good practice to avoid long repetitive programs. Sub programs like sub procedures and functions make this possible. In this lesson you will learn how to define and call a sub procedure, as well as reviewing some concepts you met in previous lessons. You will learn how a sub procedure can be defined, either within the same file as the calling program, or inside a separate file. You will also learn how to use the import keyword to make sub procedures in an external file available to a calling program.
Chapters:
00:00 Why you should use sub programs
00:41 Review – a simple calculator
03:20 Sub procedure code
06:45 Define a sub procedure with the def keyword
09:32 Define a sub procedure in a separate file
09:49 Import procedures from an external file










