Week 2 - Event-driven programming, local/global variables discussion
Week 2 - Event-driven programming, local/global variables discussion#
Learn the basics of event-driven programming
Understand difference between local and global variables
Create an interactive program that plays a simple guessing game
Week 2a - Interactive Applications in Python#
What characterizes an event-driven program?
When would you use event-driven programming?
What happens with the event queue if you press a button and if a timer times out?
How do you describe the reaction to a key press (an event in general)?
What does the Hollywood saying “Don’t call us, we’ll call you” mean in context of event-driven programming?
Local vs. Global Variables#
Imagine you have created a variable outside of a function. How can you modify this variable (without providing the variable as a parameter to your function)?
When should we use local variables and when global?
What are the advantages/perils of using global variables?
Why does this course introduce global variables if we should better not use them?
What are frame, control area, canvas and status area?
a. What is the program structure advocated by Scott Rixner for interactive programs using Codeskulptor? a. What is the advantage of this structure?
Mini-project #2 - “Guess the Number!”#
Practice Mini-project: Magical Octosphere Reloaded#
Compared to the practice project of the second week, we just have to add three lines of code. Why is that so simple?
“Guess the Number!”#
What is binary search algorithm?
How is binary search related to the game?