Course Overview
An introductory course for those interested in learning Python, programming, and how to use programming in various mathematical and scientific tasks. Students will install Python 3.8, learn the basics of Python programming, and apply the basics to various tasks. And then gradually expand to computational thinking skills behind software application design.
Introduction to Python
Session 1
- Introductory Topics
- Introductory Topics
- Conditionals & Program Flows
- Lists & More Program Flows
Session 2
- Turtles
- Functional Coding
- Object-Oriented Programming
Python App and PyGame
Session 3
- Part I : Python Review
- Part II : Design and Implementation of Games (and Applications)
Session 4+
- Part III : Introducing PyGame – 2-D Graphics Game Design using Python
Curriculum in Detail
AI003 Session#1 (16 hours)
- Introductory Topics
- Basics of Numbers
- Basics of Strings
- Taking input/output
- Variables and assignment
- Mad-Libs and String Formatting
- Conditionals & Program Flows
- Booleans and comparators
- If-elif-else statements
- And/or/not
- Nesting
- Lists & More Program Flows
- Making a list
- For loops and range
- While, break, and continue
AI003 Session#2 (16 hours)
- Turtle
- Drawing with “turtle“
- Introduction to Functions
- Functional Coding
- Modules
- Returning Values
- Object-Oriented Programming
- Classes and OOP
- Operator Overloading
- Inheritance
AI003 Session#3 (16 hours)
This session aims to reinforce the python basics in a project-based curriculum while gradually expanding to introduce computational thinking skills behind software application design. Some previous basics will be reviewed, reintroduced, and reinforced, and new topics will be introduced along the way. The project-based approach employs a pedagogical sequence: project demo -> requirements analysis -> problem presentation -> solution proposal and implementation -> reinforcement of syntax and coding concepts.
Part I – Python Review (4 hours)
This part aims to review the basics of Python that may have been taught in the prior sessions.
Project 1 – Guess the Number (1 – 1.5 hour)
Topics: : import • randint() • for • Blocks • str(), int(), float() • Booleans • Comparison • Conditional
Project 2 – A Joke-Telling Program (1 hour)
Topics: Escape • ‘ and ” • print()
Project 3 – Dragon Realm (1 – 2 hour)
Topics: functions • Multiline strings • while • Boolean operators • return • variable scope • Parameters and arguments • sleep()
Part II – Design and Implementation of Games (and Applications)
This part uses projects of increasing complexity to illustrate the computational thinking behind the design and implementation (including testing) of software applications while reinforcing previously acquired Python basics.
Interlude – Using the Debugger (1 hour)
Topics: 3 types of errors • debugger • Go and Quit • Stepping into, over, and out • Breakpoints
Project 4a – Designing Hangman with Flowcharts (1.5 – 2 hour)
Topics: ASCII art • Designing with flowcharts
Project 4b – Writing the Hangman Code (2 – 3 hours)
Topics: Lists • in operator • Methods • split(), lower(), upper(), startswith(), and endswith() • elif
Project 4c – Extending Hangman (2 hours)
Topics: dict • Key-value pairs •keys() and values() • multi-var assignment
Project 5 – Tic-Tac-Toe (3 – 4 hours)
Topics: AI • List references • Short-circuit • None
Project 6 – The Bagels Deduction Game (2 – 3 hours)
Topics: random.shuffle() • Augmented assignment operators • sort() • join() • String interpolation • conversion specifier %s • Nested loops
Interlude – The Cartesian Coordinate System (1 hour)
Topics: x-axis and y-axis • Negative numbers • Pixels • commutativity • abs()
Project 7 – Sonar Treasure Hunt (4 hours)
Topics: Data structures • Pythagorean theorem • remove() • isdigit() • sys.exit()
Project 8 – Caesar Cipher (2 – 3 hours)
Topics: Cryptography and ciphers • Ciphertext, plaintext, keys, symbols • Encrypt/decrypt • Caesar cipher • find() • Cryptanalysis • The brute-force
Project 9a – The Reversegam Game (4 – 5 hours)
Topics: bool() • Simulating moves on a Reversegam board
Project 9b – Reversegam AI Simulation (2 – 3 hours)
Topics: Simulations • Integer division • round() • Computer-versus-computer games
AI003 Session#4+ (16 – 32 hours)
Part III – Introducing PyGame – 2-D Graphics Game Design using Python
This part introduces the basics of a popular Python library (pygame) as a bridge to the concepts common in computer game development while further developing the students’ software development skills.
Project 10 – Creating Graphics (1.5 – 2 hours)
Topics: pygame • Colors and fonts • Aliased and anti-aliased graphics • Attributes • Font, Surface, Rect, PixelArray • Constructor functions • drawing functions • The blit() method for surface objects • Events
Project 11 – Animating Graphics (1.5 – 2 hours)
Topics: Animating objects with the game loop • Changing the direction of an object
Project 12 – Collision Detection (1.5 – 3 hours)
Topics: Clock objects • Keyboard input in pygame • Mouse input • Collision • list iteration caveat
Project 13 – Using Sounds and Images (1.5 – 3 hours)
Topics: Sound and image • Drawing and rescaling sprites • Adding music and sounds • Toggling sound on and off
Project 14 – A Dodger Game with Sounds and Images (1.5 – 3 hours)
Topics: pygame.FULLSCREEN • move_ip() Rect method