Consider the following modular Python program simulating a bank scenario:
Can you identify local variables in each function?
Can you identify any variables which are needed by more than 1 function?
Copy the code into a .py file. Does it work? Redesign it so that global variables are used when needed by more than 1 function.
Test your design - does it work as you expect?
Consider the following modular Python program simulating a student grades scenario:
Can you identify local variables in each function?
Can you identify any variables which are needed by more than 1 function?
Copy the code into a .py file. Does it work? Redesign it so that global variables are used when needed by more than 1 function.
Test your design - does it work as you expect?
Do you have an idea for a modular Python program that processes data in some way?
Different modules (functions) use the same variables (global) and each module can have its own local variables, too.
This is for students who are serious about developing their programming skills.
Hint: if you have no ideas, get one from AI and adapt it as you want.