We may earn an affiliate commission when you visit our partners.
Course image
Trevor Sawler

Python is one of the world's most popular programming languages, and with good reason: it is extremely flexible, easy to learn, and runs on a wide variety of devices and platforms. In fact, Python recently moved to first place in the TIOBE programming community index, which is a remarkable achievement.

Read more

Python is one of the world's most popular programming languages, and with good reason: it is extremely flexible, easy to learn, and runs on a wide variety of devices and platforms. In fact, Python recently moved to first place in the TIOBE programming community index, which is a remarkable achievement.

This course is an introduction to Python, version 3.10. Unlike many introductory courses, we will not spend hours surveying the basics of the language; personally, I see no point in doing that, since there are already many, many free resources online that do precisely that. Instead, we'll learn the language in the way that I have long preferred: we'll actually build something.

The bulk of this course will be focused on building a simple text adventure game, where the player explores a labyrinth, encounters monsters, engages in combat, finds items, and that sort of thing. It's a bit of a throwback to the early days of computer games, but the important thing here is not the quality of the game that we'll build, but rather that we'll cover all of the things you need to get started programming in Python, including:

  • Python's primitive data types: integer, float, string, and boolean

  • Python's aggregate data types: tuple, set, dictionary and list

  • How to make decisions in Python: if/elif/else

  • How to loop in Python: for and while loops

  • How to write functions

  • How to import from the standard library, and third party packages

  • How to structure a Python program

  • How to perform mathematical operations in Python

  • How to manipulate strings in Python

  • How to work with classes in Python

And, as the saying goes, much more. Periodically, I'll include "aside" lectures, which focus on a particular aspect of Python in more detail, with simple code examples that are not part of the main project.

This course requires no previous programming experience.

Enroll now

What's inside

Learning objectives

  • Learn the basics of python, one of the most popular programming languages in use today
  • Learn the syntax of the python language by writing a text-based adventure game
  • Learn about the difference between object-oriented and procedural programming
  • Learn to think like a computer scientist: making decisions, looping logic, and performing calculations
  • Learn best practices when writing python code
  • Learn how to build a terminal-based python program
  • Learn how to create a virtual environment to isolate your program and make it easy to install

Syllabus

Another aside: functions
Implementing a while loop to keep the program running

Let's figure out how to capture user input.

Installing Python (a recent version) and an IDE.
Read more

Just an introduction, and an overview of what we are going to be covering in this course.

A brief note about my background.

Macs come with Python installed by default, and you can use that, but you can install the latest version if you wish.

Windows does not include a python distribution by default. Let's install one.

For the most part, programming languages either compile source code to a binary, or run the source code through an interpreter in order to execute commands. But some languages, like Python, fall in between these two categories. Here is a brief explanation.

Let's write the customary "Hello, world!" program in Python. It's only a single line of code, but it's a start.

Let's get started with the basic structure of a Python program.

Strings, integers, booleans and floats.

You can put variables almost anywhere you want in a Python file, but where you put them matters. Let's talk about scope.

Let's get started on making decisions based on what a user types in, and give the player the option of showing a help screen and quitting the game (or playing again).

Let's have a look at Python's comparison operators and logical operators. We'll be using them a lot, so a brief overview seems appropriate.

Let's make sure that we sanitize whatever the user types, and let's finish up printing our help information.

Let's spice things up a bit by adding colour to our application, and figuring out how to clear the screen before the game starts.

Classes are incredibly useful, and we'll be using them throughout the remainder of this course. Let's explore them a bit.

We need something to keep track of the player as he or she progresses through the game, so let's create a Player class to take care of this for us.

We need somewhere to store information about every room in the game, so let's create a Room class to take care of this.

Let's define a Game class that will hold the current player, the room that the player is currently in, and all other important game related information.

Let's get started using our Player, Room, and Game classes in our adventure game.

Tuples are like lists: they are one of Python's four data structures which allow us to store more than one thing in a variable. Let's use tuples to help provide more realistic descriptions for our game.

Let's get started with allowing players to navigate around the dungeon.

Like lists and tuples, dictionaries are data structures in Python that let us store more than one thing in a variable. Unlike lists and tuples, though, dictionaries allow us to store things using key-value pairs. Let's see how they work.

We have a lot of items in our armory.py file, so let's put some in our rooms, to give the player something to find. Let's also decide if a room should have a monster or not.

An overview of the Python list data type, and adding an attribute to the Player class to keep track of inventory.

Let's get started with the logic of allowing players to pick items up.

Let's finish up the code for picking an item up, and removing it from the room once we've done so.

Let's write a simple function that allows the player to print out the contents of the current inventory.

Right now, room descriptions are displayed every time we enter a command. That's no good, so let's clean our code up a bit.

Let's implement the functionality that allows the player to drop an item, and while we're at it, let's learn about the "try/except" functionality in Python, which is similar to "try/catch" in other languages.

We can now let players find items, drop items, and show the current inventory, so let's allow them to equip, or use, weapons, armor, and shields.

Let's show the player what items from their inventory that they have equipped, and let's consider how to solve one problem that we have in the game. Plus, I give you a bit of a challenge.

Here's how I solved the challenge.

Players can now find items, pick up items, use items, and drop items, and view the inventory. The last step is to let them "unequip," or stop using items. Let's take care of that.

Let's implement the "status" command, so players can see how well they are doing in the game.

A brief overview of how combat is going to work in our adventure game.

Let's get started with combat by letting the player run away when they encounter a monster.

Let's begin with the combat logic by determining who gets to attack first.

Let's get the initial code in place for the player's turn during combat.

Now it's the monster's turn, so let's implement the logic for this part of the fight.

If the player is doing badly in the fight, they should have the chance to run away. Let's write that logic.

Once a fight is over, the player should get feedback, one way or the other, and if the monster lost, we need to make sure that the monster is taken out of the game. Let's take care of that.

Combat should be harder (or easier) depending on what armour, weapons, or shield the player has, and depending how strong the monster is. Let's adjust our math accordingly.

Let's allow the player to rest in order to regain health.

Let's have a look at what the final map will look like.

We need to make some changes to the Game class to tell it about the map. Let's do that.

Player's should not be allowed to move "outside" of the map. In order to prevent that, we need to keep track of where the player is, and check that against the current map's dimensions. Let's do that.

Syntax errors are easy to spot, since your editor typically points them out to you. Logic errors are tougher. Here is a challenge that focuses on logic errors.

Let's try out our code and modify it so that it keeps track of the player's current position on the map.

Let's take advantage of the attribute "visited" that we added to the Player class in order to keep track of where the player has been on the map.

Let's get started implementing the "map" command to show a map to the player.

Let's make the map show us useful information.

Let's finish up our map command by adding some lines at the top and bottom, and adding a legend.

Let's give our player an easy way to see how things are going by using the blessings package to add a status bar at the top of the screen.

There are only a few things left to take care of in the game; let's write the last bit of code.

Traffic lights

Read about what's good
what should give you pause
and possible dealbreakers
Uses a text-based adventure game to teach Python, which offers a fun and engaging way for beginners to learn fundamental programming concepts
Covers Python's primitive and aggregate data types, which are essential for building a strong foundation in programming
Explores object-oriented programming concepts through classes, which are widely used in modern software development
Focuses on building a terminal-based program, which may not appeal to learners interested in graphical user interfaces
Uses Python 3.10, which is a relatively recent version, ensuring that learners are using up-to-date tools and techniques
Requires installing Python and an IDE, which may present a challenge for absolute beginners with limited technical experience

Save this course

Create your own learning path. Save this course to your list so you can find it easily later.
Save

Reviews summary

Project-based python introduction

According to learners, this course provides a solid foundation in Python programming, particularly for absolute beginners. Many students found the project-based approach, centered around building a text adventure game, to be highly engaging and an effective way to learn core concepts. Reviewers frequently highlight the clarity of the lectures and the instructor's ability to explain complex ideas simply. While the course focuses on fundamentals like data types, loops, functions, and classes, some reviewers noted that it stays introductory and doesn't delve into more advanced or modern Python applications, reflecting its stated scope. Overall, the feedback is largely positive, recommending it as a great starting point.
Covers core Python basics thoroughly.
"The course covered all the basic data types, control flow, functions, and even classes really well."
"I got a strong grasp of Python's fundamental building blocks from this course."
"Good coverage of the essential Python concepts needed to start writing code."
Instructor's explanations are easy to understand.
"Lectures are really clear and bite-sized. I never felt overwhelmed by the information."
"The way the instructor breaks down complex topics is fantastic. Everything just made sense."
"Explanations are concise and to the point, making it easy to follow along with the coding demos."
Ideal for those with no prior programming experience.
"As someone completely new to programming, this course was perfect. The explanations were clear and didn't assume prior knowledge."
"The instructor explains things very simply, making it easy for absolute beginners to follow along."
"Started from scratch and felt comfortable by the end. Definitely recommend for anyone just starting out with Python."
Learning Python fundamentals through a game project works.
"Building the text adventure game was such a practical way to understand concepts like classes and functions. It wasn't just theory."
"I loved that the course was centered around a single project. It helped solidify my learning and made the concepts feel real."
"The project-based structure is a huge plus. It kept me motivated and showed how different pieces of Python fit together."
Does not cover advanced topics or diverse applications.
"While great for basics, don't expect to learn about web development or data science here. It sticks to the game project."
"It's strictly an introductory course. It gives you the foundation but you'll need other resources for specific applications."
"Felt like it ended just as I was getting comfortable; wished it went deeper into certain areas or different use cases."

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in Working with Python - Introductory Level with these activities:
Review Basic Python Syntax
Reinforce your understanding of fundamental Python syntax, including variable assignment, data types, and operators, to ensure a smooth start to the course.
Browse courses on Python Syntax
Show steps
  • Read through a Python syntax cheat sheet.
  • Write short code snippets to practice each concept.
  • Complete online quizzes to test your knowledge.
Review "Python Crash Course"
Solidify your understanding of Python fundamentals by working through the exercises and projects in "Python Crash Course."
Show steps
  • Read the first few chapters covering basic Python concepts.
  • Complete the exercises at the end of each chapter.
  • Attempt one of the larger projects to apply your knowledge.
Practice Python Data Structures
Sharpen your skills in using Python's built-in data structures (lists, tuples, dictionaries, sets) through targeted practice exercises.
Show steps
  • Solve coding problems involving list manipulation.
  • Implement dictionary lookups and updates.
  • Work through exercises involving set operations.
Four other activities
Expand to see all activities and additional details
Show all seven activities
Review "Automate the Boring Stuff with Python"
Explore practical applications of Python beyond game development to broaden your understanding of the language's capabilities.
Show steps
  • Read chapters related to file manipulation and web scraping.
  • Try implementing some of the automation scripts described in the book.
  • Adapt the scripts to solve your own real-world problems.
Document Your Text Adventure Game Journey
Reinforce your learning by documenting your progress, challenges, and solutions while building the text adventure game.
Show steps
  • Create a blog or journal to record your experiences.
  • Write about the design decisions you made and why.
  • Share code snippets and explain their functionality.
  • Reflect on what you learned from each module.
Expand the Text Adventure Game
Deepen your understanding of Python by adding new features and complexity to the text adventure game.
Show steps
  • Implement a more sophisticated combat system.
  • Add more items, monsters, and rooms to the game.
  • Introduce puzzles and challenges for the player to solve.
  • Incorporate a scoring system and a game-ending condition.
Contribute to a Python Game Library
Apply your Python skills by contributing to an open-source game library or framework.
Show steps
  • Find a suitable open-source project on GitHub.
  • Read the project's documentation and contribution guidelines.
  • Identify a bug to fix or a feature to implement.
  • Submit a pull request with your changes.

Career center

Learners who complete Working with Python - Introductory Level will develop knowledge and skills that may be useful to these careers:
Python Developer
A Python developer specializes in creating software applications using the Python programming language. This course helps build a foundation in Python programming, covering essential concepts such as data types, control structures, functions, and object oriented programming. The focus on building a text-based adventure game provides hands-on experience in designing and implementing a Python program. The course also covers how to work with the standard library, which is essential for any Python developer. This course shows how to write functions, structure a program, and manipulate strings, all of which may be useful for a Python developer.
Software Engineer
A software engineer designs, develops, and maintains software systems. This course is an excellent starting point for a career in software engineering, as it introduces the fundamentals of Python programming. The course helps build a strong understanding of data types, control flow, functions, and classes. The hands-on approach of building a text-based adventure game provides practical experience in structuring a program and solving programming problems. A software engineer may find the sections on program structure and best practices particularly relevant to their work.
Software Developer
A software developer designs, develops, and tests software applications. This course on Python helps build a foundation in one of the most popular programming languages used in software development. The course focuses on practical application by building a text adventure game, which provides experience in structuring a program, handling user input, and implementing game logic. Additionally, the course covers vital elements, such as data types, loops, functions, and classes, providing a strong base for creating more complex applications. A prospective software developer may find working through the making of the text-based adventure in this course useful to their development.
Game Developer
A game developer creates video games for various platforms. This course is directly relevant because the primary project involves building a text adventure game. This course helps build skills in game logic, user interaction, and program structure. It also introduces object oriented programming. The course covers the essentials of Python syntax and also teaches how to implement game mechanics like combat and inventory management. The hands-on experience of creating a game from scratch may be useful to a future game developer.
Scientific Programmer
A scientific programmer develops software for scientific research and simulations. Python is a popular choice in scientific computing due to its ease of use and vast ecosystem of scientific libraries. This course helps build a foundation in Python programming, covering essential concepts such as data types, control structures, and functions. A person wanting to be a scientific programmer may also want to learn how to write functions and import from the standard library.
Automation Engineer
An automation engineer designs and implements automated systems and processes. Python is a popular language for automation, and this course helps build a foundation in Python programming. The content covers essential concepts such as data types, control structures, functions, and modules. The practical experience of building a text adventure game helps with skills in problem-solving and program design. An automation engineer may find the lessons on looping logic and function writing to be vital in designing automated systems.
Data Scientist
A data scientist analyzes and interprets complex data to help organizations make better decisions. While this course may not cover data science directly, it is beneficial because Python is widely used in the field. The course helps build a strong foundation in Python programming, covering essential concepts such as data types, control structures, and functions. The course also teaches how to import from standard libraries, which are important in data science. This course may be useful to learn the fundamentals of Python.
Robotics Engineer
A robotics engineer designs, builds, and programs robots for various applications. Python is frequently used in robotics for control systems and data processing. This course is a helpful starting point. The course offers a foundation in Python programming, which may be useful in a robotics engineer's pursuit of their career. A robotics engineer may find that the fundamentals taught in the course provide essential skills.
Web Developer
A web developer builds websites and web applications. While this course focuses on a terminal-based game, it may be useful because Python is often used for back-end web development. The course helps build essential Python skills, including working with data types, control structures, and functions. The course also covers how to structure a Python program, which is crucial for building larger web applications. A web developer may find the sections on manipulating strings and working with loops to be relevant when working on web projects.
DevOps Engineer
A DevOps engineer manages and automates software development and deployment processes. Python is often used for scripting and automation in DevOps, so this course may be beneficial. The course helps build a foundation in Python programming, covering essential concepts such as data types, control structures, and functions. The course also introduces how to use third-party packages, which may be useful for DevOps tasks. A DevOps engineer may find this course helpful in learning the fundamentals of Python.
Data Analyst
A data analyst collects, cleans, and analyzes data to identify trends and insights. While this course is introductory, Python is a common tool in data analysis, and learning its fundamentals may be useful. The course provides a solid introduction to Python programming, covering essential concepts like data types, loops, and functions. A data analyst may find the experience that this course provides useful for data analysis tasks.
Embedded Systems Engineer
An embedded systems engineer develops software for embedded systems, which are specialized computer systems within devices like appliances and vehicles. While typically C or C++ are programming languages of choice, due to increasing computing power, Python can be useful. This course offers a foundation in Python programming. Although, the course is not specific to embedded systems, an budding embedded systems engineer may find the fundamentals essential.
Quality Assurance Engineer
A quality assurance engineer tests software to ensure it meets quality standards. This course may be useful because Python can be used to write automated tests. It covers essential Python programming concepts, such as data types, conditional statements, and loops. The course may also help teach problem-solving skills, which are important for identifying and debugging issues. A quality assurance engineer may find the knowledge they gain in this course useful for testing software.
Financial Analyst
A financial analyst analyzes financial data to provide insights and recommendations to businesses and investors. While not directly related to finance, Python is increasingly used in financial modeling and analysis. This course helps build a basic foundation in Python programming. The course also helps build skills in structuring programs and performing mathematical operations. A financial analyst may find this course useful in their career.
IT Support Specialist
An information technology support specialist provides technical assistance to computer users. While this role doesn't directly involve extensive programming, Python can be a valuable tool for automating tasks and troubleshooting issues. The course may be useful as it covers the basics of Python programming, including data types, control flow, and functions. Although a support specialist does not need extensive coding knowledge, this course can help them gain valuable skills.

Reading list

We've selected two books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Working with Python - Introductory Level.
Python Crash Course great book for beginners to get up to speed with Python. It covers the basics of Python programming in a clear and concise manner. It includes hands-on projects that allow you to apply what you've learned. is particularly useful for those with little to no prior programming experience.
Provides practical examples of how Python can be used to automate everyday tasks. While not directly related to game development, it reinforces core Python concepts and demonstrates the language's versatility. It's a good resource for expanding your Python knowledge beyond the scope of the course. This book is commonly used as a reference for automating tasks.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Similar courses are unavailable at this time. Please try again later.
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2025 OpenCourser