1/18
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
Logical Operators
operators, often referred to as Boolean operators that compare two Boolean operators: and, or, not
Modular Code
code organized into independent, self-contained units or modules that can be easily reused, maintained, and integrated with other parts of a program. Improves readability simplifies debugging, and enhances scalability especially in large programming
Functions
reusable blocks of code that perform a specific task when called
Abstraction
a technique or process that manages complexity in a program or computer program. It hides detail or removes duplication, allowing the programmer to focus on high-level considerations and function rather than rules of a programming language
Procedural Abstraction
using functions or procedures to simplify complex tasks by focusing on what they do, not how they work internally
Scope of Variables
the part of a program where a variable can be accessed or modified
Global Variables
a variable with a broad scope
Local Variables
variables declared inside a function
Benefits of modular code:
Increases readability of code
Easier to maintain and make changes to code
Reuse functionality of code
Abstraction, defintions:
simplifying complex systems by focusing on essential details and hiding unnecessary ones
What do we create in Python to write code that uses abstraction?
Functions or procedures
Benefits of procedural abstraction:
Provides a name for a process and allows it to be used only knowing what it does and not how it does it
Makes code reuse easier and helps manage complexity
Interrupts the sequential execution of statements, causing the program to execute the statements within the procedures (function) before continuing (no need to duplicate code)
Syntax for defining functions:
Def function_name():
Body of function
Syntax for calling functions:
function_name() <- parenthesis will have variables inside if the function definition takes parameters - remember, these are the input value to the function
What does scope of variables mean
the area of a program where a variable is recognized and can be used
What does global scope mean
the variable can be accessed anywhere in the program
Can you identify a global variable in a Python program?
Yes, it would have the keyword global
What does local scope mean
the variable only exists within the function it’s defined in
Can you identify a local variable in a Python program?
Yes, it wouldn’t have the keyword global