Module # 7 - Introduction to Python - An 'Interpreted' Language
Due: Last day of the course
We will be following a familiar pathway to learning Python, However, you will be happy to note that we only be completing SOME initial practice exercises as you already are familiar with many general programming concepts. Are unit will consist of initial practice, then some game making and then some related project work. Good luck and have fun!
Python IDLE utility links
Please use this link for downloads (should that be necessary)
Multi - threading explained (can speed up program run time)
(Here is a decent set of install instructions )
(*) Note: Python IDLE 3.9 is already installed in the lab.
Part I - Introduction to Python - An interpretive language
Introduction (read / reflect / respond)
What are the key differences between a compiled language (Java) and an 'interpreted' language (Python) ?
Read this article Differences between compiler and interpreter / Another good link! / Python "The good, the bad the ugly"
How does a Python IDLE work? Here is a comprehensive introduction / why is Python still so popular? / second link
Python IDLE install site - You might need to install a legacy version of Python (version 2) to run some of the game instructions. We'll see as we progress through the unit.
Please make a table or chart that clearly explains the following:
What makes Python (an interpretive language) different than a compiled language like Java? Explain the key differences in bullet form
Why is Python still so popular despite being so slow during runtime? Explain?
Part II - Practice Module
As with any new language, we will need to do some practice to learn the conventions of the Python language. However, we'll be doing less than with JAVA as you already have a solid background on programming fundamentals and typical coding structures.
Coding practice (Python)
Learn Python 3 the Hard way (textbook PDF - different author same title) (If you have practiced Python previously then choose a DIFFERENT 14 exercises to complete.
Download PDF textbook from the above one drive link.
For your reference - W3 Schools Python
Write your Python code using the Python IDLE 3.9 located in the program menu ( open Python 3.9 folder and look for the IDLE)
Please complete the following exercises: (or choose your own collection as long as it adds up to 14 in total!)
Exercises 1 - 7 (covers many familiar activities) - (NO study drills)
Exercises 10 - 17 Python essentials continued...(study drills at least one) Note: exercise 13 MUST have THREE arguments and no more
If you're having trouble with exercise 13 from the lessons - here is a great discussion of unpacking variables!
(Hint:) - in the Python Shell - select RUN from the top menu bar and then select 'run...customize" (or Shift F5) and then name the three variables (note: NOT four) any name you wish... so for example type in: first second third (then run) and then it will execute and ask you to describe the fourth variable!
Or you can use Window's powershell the accomplish the same thing but you will need to use a few powershell keystrokes to get there...eg "cd" (change directory) to get to the location of the file you wish to execute...) see blue screenshot at the bottom of this unit for an example! :)
You will start to see many similarities between Python and JAVA. However, Python is known for being an easier and more intuitive coding language. Due to time constraints we are only going to complete a smaller collection of practice exercises but you are encouraged to use this textbook as a reference guide.
Part III - Games and So Much More!
Game 1 - Rock, paper scissors...(make at least four modifications to the game's behaviour and design)
In this first project, you will work with Python scripts in a very structured format to make a simple game. Once you have typed in the game code (don't copy and paste please) you will then be tasked to make structural improvements to the quality of the game play. What improvements to its design is up to you, however, you are expected to add in a developer comment into the top of the game code explicitly explaining HOW you changed and improved this classic game. Good luck and happy gaming!
Instruction set(s) - you choose which one to follow:
You will need to import modules for this game and others. Using prebuilt libraries allows you to build out programming capacity with only some basic skills. Read this link that outlines "importing" in Python
Some to modify the above game: add in more game objects such as a hammer or a butterfly.../ best 'two out of three / change how you 'win'...
PY Charm - Download and install link (sould be installed already)
How to get Py Charm to work on Py Game (short video)
Once installed - please 'link up the libraries ' Install instructions for py game
IF THE ABOVE INSTRUCTION SET(S) DON'T WORK THEN TRY THE 'STEP BY STEP' AT THE BOTTOM OF THIS SECTION!
Game 2
Racing Car game
make a car racing game (turtle library download and install - video installation guide / Here is a basic list of Terminal shell command prompts
Game 3
Classic game of 'snake' in Python (only do if you can get the "Platform Game to run!)
Classic game of 'snake' in Python / Here is a set of instructions that has a greater 'diversity' of snake game styles
Part IV - Choice Project to complete (choose THREE in total from one or both of the links below)
There are 81 in total. The following projects are essentially laid out for you but they offer specific ways to change or enhance the work.
Python Project link Database # 1
OR
Mad Libs / Guess the Number Game (computer) / Guess the Number Game (user) / Hangman / Countdown Timer / Password Generator / QR code encoder / decoder / Tic-Tac-Toe / Tic-Tac-Toe AI / Binary Search / Minesweeper / Sudoku Solver / Photo manipulation in Python / Markov Chain Text Composer / Pong * / Connect Four * / Tetris / Online Multiplayer Game / Web Scraping Program / Bulk file renamer / Weather Program / Code a Discord Bot with Python - Host for Free in the Cloud / Space invaders game
(*) Note: the *'d project activities are quite time consuming and on the difficult side...so be cautioned before you begin!
Game Intro. and installs... Use the built in Arcade libraries inside Python 3.12.3 to create a collection of arcade games
In order to be able to develop games in Python 3 you will need to conduct a few installs. Some of these might have already been done for you but it would probably be best for you to conduct these installs anyway. (You might need my admin password - if not already installed)
PyCharm (by Jet Brains): Python Development platform
An excellent primer to working with Python Arcade (reference only)
Install Arcade libraries INSIDE PyCharm and a Virtual Environment to run graphic based Python games please follow the following link.
Install the Arcade and game related libraries inside of the Python IDLE (please do this or check if it has been done)
Suplemental instruction set:
Installing PyCharm, a popular Python IDE, and Pygame, a set of Python modules for writing games, involves a few steps. Here's a general guide:
1. **Install Python**: Before installing PyCharm and Pygame, ensure that you have Python installed on your system. You can download and install Python from the official Python website: https://www.python.org/downloads/ Also make sure that that python is added to the PATH and that pip is properly installed.
2. **Install PyCharm**:
- Go to the JetBrains website: https://www.jetbrains.com/pycharm/download/
- Download the version of PyCharm (Community or Professional) that is compatible with your operating system.
- Follow the installation instructions provided by JetBrains for your operating system.
3. **Create a New Project in PyCharm**:
- Open PyCharm.
- Create a new project by selecting "File" > "New Project".
- Choose the location and interpreter (the Python installation) for your project.
4. **Install Pygame**:
- Once you have your project set up in PyCharm, you need to install Pygame. You can do this using pip, Python's package manager.
- Open PyCharm's terminal (Four lines on top left > View > Tool Windows > Terminal). Or press Alt + F12
- Type the following command and press Enter to install Pygame:
pip install pygame
5. **Verify Pygame Installation**:
- After installation, you can verify that Pygame is correctly installed by importing it into a Python file and running a simple test:
```python
import pygame
- If there are no errors, Pygame is installed successfully.
6. **Start Developing**:
- Now you're ready to start developing games with Pygame in PyCharm! You can create Python scripts, import Pygame modules, and build your games within your PyCharm project.
That's it! You've installed PyCharm and Pygame, and you're all set to develop games using Python. If you encounter any issues during the installation process, feel free to ask for further assistance!
Introduction to Game Development
An excellent discussion of game development procedures in Python AND the power of adding in calls to object oriented features
A few arcade style Python game examples (for reference ONLY)