Learning Programming with Fundamentals of Computing

A snippet of Python code that prints a welcome message.

Introduction to Interactive Programming in Python - Week 3

Week 3 introduces the basics of event-driven programming and covers the differences between local and global variables. This week's mini project is "Guess the Number", a simple game where the player attempts to guess a randomly generated secret number in a certain number of tries.

Screenshot of Guess the Number website
My re-creation of Guess the Number in JavaScript.

Mini Project 3

This week's mini project is to create the game Guess the Number. To do so, we need to write three categories of functions: a helper function to start and restart the game, event handlers for the control panel of the graphical user interface (GUI), and an input_guess function that contains the main logic of the game. We'll also need to register the event handlers and start the GUI frame. Note that the syntax for this final step is specific to CodeSkulptor, but the concept applies to other GUI packages in Python such as Tkinter.

See my complete implementation of Mini Project 3 on GitHub.