The
Python Workshop

Learn how to code with Python for free with the structured, step-by-step and self-paced workshop learning program by Packt.

Enroll Today for Free

You'll be up and running with Python in no time at all, no hidden charges or fees.

  • Free

    FreeThe Python Workshop

    Unlock one year of full, unlimited access!
    Learn for Free

Learning Made Simple

Nobody likes going through hundreds of pages of dry theory, or struggling with uninteresting examples that don’t compile. We've got you covered. Any time, any device.

  • Learn by doing real-world development, supported every step of the way with step-by-step examples and expert screencasts.

  • Become a verified practitioner and earn an authenticated digital certificate from Packt upon successful completion.

  • Manage your learning based on your personal schedule, with content that lets you pause and resume your progress at will.

Learn Python for Free

It's the perfect way to get started with web development, data science, scripting and more.

The Python Workshop is ideal if you're looking for a structured, self-paced way to get started with programming for the first time.
Get Started for Free

Course Curriculum

An A to Z tour of the Python language.

  • Workshop Onboarding

    • Welcome to the Python Workshop
    • Installation and Setup
    • Credits
  • 1. Vital Python: Math, Strings, Conditionals, and Loops

    • Overview
    • Vital Python
    • Exercise 1: Getting to Know the Order of Operations
    • Spacing in Python
    • Exercise 2: Integer and Float Types
    • Complex Number Types
    • Exercise 3: Assigning Variables
    • Changing Types
    • Activity 1: Assigning Values to Variables
    • Activity 1: Assigning Values to Variables
    • Variable Names
    • Exercise 4: Variable Names
    • Exercise 5: Multiple Variables in Python
    • Comments
    • Exercise 6: Comments in Python
    • Docstrings
    • Activity 2: Finding a Solution Using the Pythagorean Theorem in Python
    • Activity 2: Finding a Solution Using Pythagorean Theorem in Python
    • Strings: Concatenation, Methods, and input()
    • Exercise 7: String Error Syntax
    • Escape Sequences with Quotes
    • Exercise 8: Displaying Strings
    • String Operations and Concatenation
    • Exercise 9: String Concatenation
    • String Interpolation
    • Exercise 10: String Methods
    • Casting
    • Exercise 11: Types and Casting
    • The input() Function
    • Exercise 12: The input() Function
    • Activity 3: Using the input() Function to Rate Your Day
    • Activity 3: Using the input() Function to Rate Your Day
    • String Indexing and Slicing
    • Exercise 13: Boolean Variables
    • Logical Operators
    • Exercise 14: Comparison Operators
    • Comparing Strings
    • Exercise 15: Comparing Strings
    • Conditionals
    • Exercise 16: Using the if Syntax
    • if else
    • Exercise 17: Using the if-else Syntax
    • The elif Statement
    • Activity 4: Finding the Least Common Multiple (LCM)
    • Activity 4: Finding the Least Common Multiple (LCM)
    • Programs
    • Exercise 18: Calculating Perfect Squares
    • Exercise 19: Real Estate Offer
    • The for Loop
    • Exercise 20: Using for Loops
    • Activity 5: Building Conversational Bots Using Python
    • Activity 5: Building Conversational Bots Using Python
    • Summary
  • 2. Python Structures

    • Overview
    • The Power of Lists
    • Exercise 21: Working with Python Lists
    • Matrices as Nested Lists
    • Exercise 22: Using a Nested List to Store Data from a Matrix
    • Activity 6: Using a Nested List to Store Employee Data
    • Activity 6: Using a Nested List to Store Employee Data
    • Matrix Operations
    • Exercise 23: Implementing Matrix Operations (Addition and Subtraction)
    • Matrix Multiplication Operations
    • Exercise 24: Implementing Matrix Operations (Multiplication)
    • List Methods
    • Exercise 25: Basic List Operations
    • Accessing an Item from a List
    • Exercise 26: Accessing an Item from Shopping List Data
    • Adding an Item to a List
    • Exercise 27: Adding Items to Our Shopping List
    • Dictionary Keys and Values
    • Exercise 28: Using a Dictionary to Store a Movie Record
    • Activity 7: Storing Company Employee Table Data Using a List and a Dictionary
    • Activity 7: Storing Company Employee Table Data Using a List and a Dictionary
    • Zipping and Unzipping Lists Using zip()
    • Exercise 29: Using the zip() Method to Manipulate Dictionaries
    • Dictionary Methods
    • Exercise 30: Accessing a Dictionary Using Dictionary Methods
    • Tuples
    • Exercise 31: Exploring Tuple Properties in Our Shopping List
    • A Survey of Sets
    • Exercise 32: Using Sets in Python
    • Set Operations
    • Exercise 33: Implementing Set Operations
    • Choosing Types
    • Summary
    • Survey 1
  • 3. Executing Python: Programs, Algorithms, and Functions

    • Overview
    • Python Scripts and Modules
    • Exercise 34: Writing and Executing our First Script
    • Exercise 35: Writing and Importing our First Module
    • Shebangs in Ubuntu
    • Exercise 36: Adding a Docstring to my_module.py
    • Imports
    • Exercise 37: Finding the System Date
    • The if __name__ == "__main__" Statement
    • Activity 8: What's the Time?
    • Activity 8: What's the Time?
    • Python Algorithms
    • Exercise 38: The Maximum Number
    • Time Complexity
    • Exercise 39: Using Bubble Sort in Python
    • Searching Algorithms
    • Exercise 40: Linear Search in Python
    • Exercise 41: Binary Search in Python
    • Basic Functions
    • Exercise 42: Defining and Calling the Function in Shell
    • Exercise 43: Defining and Calling the Function in Python Script
    • Exercise 44: Importing and Calling the Function from the Shell
    • Positional Arguments
    • Exercise 45: Defining the Function with Keyword Arguments
    • Positional and Keyword Arguments
    • Exercise 46: Defining the Function with Positional and Keyword Arguments
    • *args and **kwargs Arguments
    • Exercise 47: Using **kwargs
    • Activity 9: Formatting Customer Names
    • Activity 9: Formatting Customer Names
    • Iterative Functions
    • Exercise 48: A Simple Function with a For Loop
    • Exercise 49: Exiting the Function During the For Loop
    • Activity 10: The Fibonacci Function with an Iteration
    • Activity 10: The Fibonacci Function with an Iteration
    • Recursive Functions
    • Exercise 50: Recursive Countdown
    • Exercise 51: Factorials with Iteration and Recursion
    • Activity 11: The Fibonacci Function with Recursion
    • Activity 11: The Fibonacci Function with Recursion
    • Dynamic Programming
    • Exercise 52: Summing Integers
    • Timing Your Code
    • Exercise 53: Timing Your Code
    • Activity 12: The Fibonacci Function with Dynamic Programming
    • Activity 12: The Fibonacci Function with Dynamic Programming
    • Helper Functions
    • Exercise 54: Helper Currency Conversion
    • Variable Scope
    • Exercise 55: The First Item in a List
    • Mapping with Lambda Functions
    • Exercise 56: Mapping with a Logistic Transform
    • Filtering with Lambda Functions
    • Exercise 57: Using the Filter Lambda
    • Sorting with Lambda Functions
    • Summary
  • 4. Extending Python, Files, Errors, and Graphs

    • Overview
    • Reading Files
    • Exercise 58: Reading a Text File Using Python
    • Exercise 59: Reading Partial Content from a Text File
    • Writing Files
    • Exercise 60: Creating and Writing Content to Files to Record the Date and Time in a Text File
    • Preparing for Debugging (Defensive Code)
    • Exercise 61: Working with Incorrect Parameters to Find the Average Using Assert with Functions
    • Plotting Techniques
    • Exercise 62: Drawing a Scatter Plot to Study the Data between Ice Cream Sales versus Temperature
    • Exercise 63: Drawing a Line Chart to Find the Growth in Stock Prices
    • Exercise 64: Plotting Bar Plots to Grade Students
    • Exercise 65: Creating a Pie Chart to Visualize the Number of Votes in a School
    • Exercise 66: Generating a Heatmap to Visualize the Grades of Students
    • Exercise 67: Generating a Density Plot to Visualize the Score of Students
    • Exercise 68: Creating a Contour Plot
    • Extending Graphs
    • Exercise 69: Generating 3D plots to Plot a Sine Wave
    • The Don'ts of Plotting Graphs
    • Activity 13: Visualizing the Titanic Dataset Using a Pie Chart and Bar Plots
    • Activity 13: Visualizing the Titanic Dataset Using a Pie Chart and Bar Plots
    • Summary
  • 5. Constructing Python: Classes and Methods

    • Overview
    • Classes and Objects
    • Exercise 70: Exploring Strings
    • Defining Classes
    • Exercise 71: Creating a Pet Class
    • The __init__ method
    • Exercise 72: Creating a Circle Class
    • Default Arguments
    • Exercise 73: The Country Class with Keyword Arguments
    • Methods
    • Exercise 74: Adding an Instance Method to Our Pet Class
    • Adding Arguments to Instance Methods
    • Exercise 75: Computing the Size of Our Country
    • The __str__ method
    • Exercise 76: Adding a __str__ Method to the Country Class
    • Static Methods
    • Exercise 77: Refactoring Instance Methods Using a Static Method
    • Class Methods
    • Exercise 78: Extending Our Pet Class with Class Methods
    • Properties
    • Exercise 79: The Full Name Property
    • The Setter Method
    • Exercise 80: Writing a Setter Method
    • Validation via the Setter Method
    • Inheritance
    • Exercise 81: Inheriting from the Person Class
    • Sub-Classing Classes from Python Packages
    • Exercise 82: Sub-Classing the datetime.date Class
    • Overriding Methods
    • Calling the Parent Method with super()
    • Exercise 83: Overriding Methods Using super()
    • Multiple Inheritance
    • Exercise 84: Creating a Consultation Appointment System
    • Method Resolution Order
    • Activity 14: Creating Classes and Inheriting from a Parent Class
    • Activity 14: Creating Classes and Inheriting from a Parent Class
    • Summary
  • 6. The Standard Library

    • Overview
    • The Importance of the Standard Library
    • Exercise 85: Using the dataclass Module
    • Exercise 86: Extending the echo.py Example
    • Dates and Times
    • Exercise 87: Comparing datetime across Time Zones
    • Exercise 88: Calculating the Time Delta between Two datetime Objects
    • Exercise 89: Calculating the Unix Epoch Time
    • Activity 15: Calculating the Time Elapsed to Run a Loop
    • Activity 15: Calculating the Time Elapsed to Run a Loop
    • Interacting with the OS
    • Exercise 90: Inspecting the Current Process Information
    • Using pathlib
    • Exercise 91: Using the glob Pattern to List Files within a Directory
    • Listing All Hidden Files in Your Home Directory
    • Exercise 92: Customizing Child Processes with env vars
    • Activity 16: Testing Python Code
    • Activity 16: Testing Python Code
    • Logging
    • Exercise 93: Using a logger Object
    • Logging in warning, error, and fatal Categories
    • Exercise 94: Configuring the Logging Stack
    • Collections
    • Exercise 95: Counting Words in a Text Document
    • defaultdict
    • Exercise 96: Refactoring Code with defaultdict
    • ChainMap
    • Exercise 97: Using lru_cache to Speed Up Our Code
    • Partial
    • Exercise 98: Creating a print Function That Writes to stderr
    • Activity 17: Using partial on class Methods
    • Activity 17: Using partial on class Methods
    • Summary
    • Survey 2
  • 7. Becoming Pythonic

    • Overview
    • Using List Comprehensions
    • Exercise 99: Introducing List Comprehensions
    • Exercise 100: Using Multiple Input Lists
    • Activity 18: Building a Chess Tournament
    • Activity 18: Building a Chess Tournament
    • Set and Dictionary Comprehensions
    • Exercise 101: Using Set Comprehensions
    • Exercise 102: Using Dictionary Comprehensions
    • Activity 19: Building a Scorecard Using Dictionary Comprehensions and Multiple Lists
    • Activity 19: Building a Scorecard Using Dictionary Comprehensions and Multiple Lists
    • Default Dictionary
    • Exercise 103: Adopting a Default Dict
    • Iterators
    • Exercise 104: The Simplest Iterator
    • Exercise 105: A Custom Iterator
    • Exercise 106: Controlling the Iteration
    • Itertools
    • Exercise 107: Using Infinite Sequences and takewhile
    • Exercise 108: Turning a Finite Sequence into an Infinite One, and Back Again
    • Generators
    • Exercise 109: Generating a Sieve
    • Activity 20: Using Random Numbers to Find the Value of Pi
    • Activity 20: Using Random Numbers to Find the Value of Pi
    • Regular Expressions
    • Exercise 110: Matching Text with Regular Expressions
    • Exercise 111: Using Regular Expressions to Replace Text
    • Activity 21: Regular Expressions
    • Activity 21: Regular Expressions
    • Summary
  • 8. Software Development

    • Overview
    • Debugging
    • Exercise 112: Debugging a Salary Calculator
    • Activity 22: Debugging Sample Python Code for an Application
    • Activity 22: Debugging Sample Python Code for an Application
    • Automated Testing
    • Exercise 113: Checking Sample Code with Unit Testing
    • Writing a Test with pytest
    • Exercise 114: Creating a Distribution That Includes Multiple Files within a Package
    • Adding More Information to Your Package
    • Exercise 115: Documenting a Divisible Code File
    • More Complex Documentation
    • Exercise 116: Making a Change in CPython Using git
    • Summary
  • 9. Practical Python: Advanced Topics

    • Overview
    • Developing Collaboratively
    • Exercise 117: Writing Python on GitHub as a Team
    • Dependency Management
    • Exercise 118: Creating and Setting Up a conda Virtual Environment to Install numpy and pandas
    • Saving and Sharing Virtual Environments
    • Exercise 119: Sharing Environments between a conda Server and Your Local System
    • Multiprocessing
    • Exercise 120: Working with execnet to Execute a Simple Python Squaring
    • Multiprocessing with the Multiprocessing Package
    • Exercise 121: Using the Multiprocessing Package to Execute a Simple Python Program
    • Multiprocessing with the Threading Package
    • Exercise 122: Using the Threading Package
    • Parsing Command-Line Arguments in Scripts
    • Exercise 123: Introducing argparse to Accept Input from the User
    • Positional Arguments
    • Exercise 124: Using Positional Arguments to Accept Source and Destination Inputs from a User
    • Performance and Profiling
    • Exercise 125: Using PyPy to Find the Time to Get a List of Prime Numbers
    • Cython
    • Exercise 126: Adopting Cython to Find the Time Taken to get a List of Prime Numbers
    • Profiling
    • Activity 23: Generating a List of Random Numbers in a Python Virtual Environment
    • Activity 23: Generating a List of Random Numbers in a Python Virtual Environment
    • Summary
    • Survey 3
  • 10. Data Analytics with pandas and NumPy

    • Overview
    • NumPy and Basic Stats
    • Exercise 127: Converting Lists to NumPy Arrays
    • Exercise 128: Calculating the Mean of the Test Score
    • Exercise 129: Finding the Median from a Collection of Income Data
    • Skewed Data and Outliers
    • Exercise 130: Finding the Standard Deviation from Income Data
    • Matrices
    • Exercise 131: Matrices
    • Computation Time for Large Matrices
    • Exercise 132: Creating an Array to Implement NumPy Computations
    • The pandas Library
    • Exercise 133: Using DataFrames to Manipulate Stored Student testscore Data
    • Exercise 134: DataFrame Computations with the Student testscore Data
    • Exercise 135: Computing DataFrames within DataFrames
    • New Rows and NaN
    • Exercise 136: Concatenating and Finding the Mean with Null Values for Our testscore Data
    • Cast Column Types
    • Exercise 137: Reading and Viewing the Boston Housing Dataset
    • Exercise 138: Gaining Data Insights on the Boston Housing Dataset
    • Null Values
    • Exercise 139: Null Value Operations on the Dataset
    • Replacing Null Values
    • Exercise 140: Creating a Histogram Using the Boston Housing Dataset
    • Histogram Functions
    • Exercise 141: Creating a Scatter Plot for the Boston Housing Dataset
    • Correlation
    • Exercise 142: Correlation Values from the Dataset
    • Regression
    • Exercise 143: Box Plots
    • Violin Plots
    • Activity 24: Data Analysis to Find the Outliers in Pay versus the Salary Report in the UK Statistics Dataset
    • Activity 24: Data Analysis to Find the Outliers in Pay versus the Salary Report in the UK Statistics Dataset
    • Summary
  • 11. Machine Learning

    • Overview
    • Introduction to Linear Regression
    • Exercise 144: Using Linear Regression to Predict the Accuracy of the Median Values of Our Dataset
    • Linear Regression Function
    • Exercise 145: Using the cross_val_score Function to Get Accurate Results on the Dataset
    • Concept of Underfitting and Overfitting
    • Exercise 146: Using K-Nearest Neighbors to Find the Median Value of the Dataset
    • Exercise 147: K-Nearest Neighbors with GridSearchCV to Find the Optimal Number of Neighbors
    • Decision Trees and Random Forests
    • Exercise 148: Decision Trees and Random Forests
    • Random Forest Hyperparameters
    • Exercise 149: Random Forest Tuned to Improve the Prediction on Our Dataset
    • Classification Models
    • Exercise 150: Preparing the Pulsar Dataset and Checking for Null Values
    • Logistic Regression
    • Exercise 151: Using Logistic Regression to Predict Data Accuracy
    • Other Classifiers
    • Exercise 152: Using GaussianNB, KneighborsClassifier, DecisionTreeClassifier, and RandomForestClassifier to Predict Accuracy in Our Dataset
    • Confusion Matrix
    • Exercise 153: Finding the Pulsar Percentage from the Dataset
    • Exercise 154: Confusion Matrix and Classification Report for the Pulsar Dataset
    • Boosting Methods
    • Exercise 155: Using AdaBoost to Predict the Best Optimal Values
    • Activity 25: Using Machine Learning to Predict Customer Return Return Rate Accuracy
    • Activity 25: Using Machine Learning to Predict Customer Return Return Rate Accuracy
    • Summary
  • Hack Your Brain

    We've applied the latest pedagogical techniques to deliver a truly multimodal experience. It'll keep you engaged and make the learning stick. It's science!

  • Build Real Things

    Nobody likes wasting their time. We cut right to the action and get you building real skills that real, working developers value. The perfect approach for a career move.

  • Learn From Experts

    We've paired technical experts with top editorial talent. They've worked hard to deliver you the maximum impact for each minute you spend learning. It's our secret sauce.

Join over 60,000 new Python programmers

Here is some what they have to say about The Python Workshop

Amazing

Federico Patito

This course is excelent, with this course you learn a lot of topics and each topic has some exercises that are very u...

Read More

This course is excelent, with this course you learn a lot of topics and each topic has some exercises that are very useful.

Read Less

Very detailed workshop with good excercises and activites

Ajijul Hakim Abid

Very good in-depth workshop in python. Goes over almost every topics but some topics could have a more detailed expla...

Read More

Very good in-depth workshop in python. Goes over almost every topics but some topics could have a more detailed explanation. Would't recommend for someone totally new to programming.

Read Less

Great Introductory Course

mohammad nazeri

This course covers basic Python syntax, how to develop software in python, how to work in a team, and an introduction...

Read More

This course covers basic Python syntax, how to develop software in python, how to work in a team, and an introduction to data science and machine learning with Python.

Read Less

An excellent way to learn Python

Juan Alberto Cañero Tamayo

I like the methodology applied to this workshop, it starts from the basic and a good explanation of the subjects plus...

Read More

I like the methodology applied to this workshop, it starts from the basic and a good explanation of the subjects plus a plenty of examples helps you to understand Python.

Read Less

5 Stars for the content !

Mahesh Deshpande

I belong to mechanical background and started leaning any kind of programming in my life with this course. This is to...

Read More

I belong to mechanical background and started leaning any kind of programming in my life with this course. This is too good for a beginner like me. The content is properly given and exercise and activities are also good. Video explainations help a lot ! The only problem I faced was the kernel busy problem in the Jupyter IDE. Otherwise I found Jupyter most user friendly as compared to other IDEs. Thanks Packt for this course !

Read Less

The most satisfying python workshop i ever attended!

Sanket Gadge

I have attended many python workshops, but this one is really great, the content is super awesome. Actually all the c...

Read More

I have attended many python workshops, but this one is really great, the content is super awesome. Actually all the courses workshops i ever attended they never taught me (for ex. say logging) everything in python, but this workshop even covers the python from beginner to advanced. With activities included, this workshop made me think more and more rather than just going through the content and reading text and videos. I learned a ton here. Thank you for all the coaches who creating this extra ordinary content.

Read Less

Different and made for people like me

Muizz Lateef

I have been watching tutorial videos for over 6 months now and not really confident yet, but few minutes into this te...

Read More

I have been watching tutorial videos for over 6 months now and not really confident yet, but few minutes into this text approach and i am already getting the whole idea

Read Less

Excellent Course Overall

Jon Hill

Had some familiarity with Python before starting the course and working through the exercises and activities, certain...

Read More

Had some familiarity with Python before starting the course and working through the exercises and activities, certainly picked up some things that I had missed before and filled some gaps in my knowledge. Course needs a bit of proof-reading as a number of errors sprinkled throughout. Found the Activities needed a little more guidance rather than being vague but worked out in the end. Overall excellent course, especially for those beginning with Python as covers a full spectrum of Python requirements. Many thanks

Read Less

Review for the Python Workshop

Samapriya Trivedi

This workshop provides one of the best educative content for the Python available on internet. Got to know a lot abou...

Read More

This workshop provides one of the best educative content for the Python available on internet. Got to know a lot about Python and it's working in a very elaborate manner.

Read Less

Learning Python is Easier

Jayabalan Ravichandiran

Python concepts and using those in practice , made easier to know about python. Core concepts are explained in detail...

Read More

Python concepts and using those in practice , made easier to know about python. Core concepts are explained in detail . The activities enables to play & know python more than reading through only concepts . The Best of python course is here ....

Read Less

Real Python lover... The Packt.

Jonty Rhodes

What can I say this website is very good for beginners. Although this website enhancing my programming experience al...

Read More

What can I say this website is very good for beginners. Although this website enhancing my programming experience also. keep it up. May Allah bless you.

Read Less

Attila Sebők's review

Attila Sebők

A Python Workshop kellemes meglepetés volt számomra. Tetszett a tema csoportosítása. Sokat tanultam a Workshopból. Am...

Read More

A Python Workshop kellemes meglepetés volt számomra. Tetszett a tema csoportosítása. Sokat tanultam a Workshopból. Ami lehetne jobb: naprakész hibajavítás a leckékben és a tesztekben.

Read Less

One of the best place to learn

NAGA SANKARA SAI KARTHIK MUKKU

This workshop course is not a pack of subject but also helps in connecting real-world and also provide wide-range of ...

Read More

This workshop course is not a pack of subject but also helps in connecting real-world and also provide wide-range of concepts which make this workshop stand out of the box

Read Less

Great workshop

Djoko Cahyo Utomo Lieharyani

This workshop gives a provide broad insight into python, more to practical exercises and activities. There are some p...

Read More

This workshop gives a provide broad insight into python, more to practical exercises and activities. There are some problems tough, like some wrong script, redundant question, and no clear definition on some part (around 15% of 100% I guess), but the discussion part is helpful, coz sometimes with reading discussion part make some problem clear. My suggestion is to make the workshop perfect by validating the disscussion part.

Read Less

Excellent!

Marcos Souza

I was very surprised by the quality of this course. Its well organized, full of examples on the subjects it is teachi...

Read More

I was very surprised by the quality of this course. Its well organized, full of examples on the subjects it is teaching, relevant quizzes and exercises, and even videos. Its by far the best free course i've ever seen.

Read Less

Course content

Edward Amankwah

A great way to review the length and breath of Python language. It introduces more concepts that can be pursued furth...

Read More

A great way to review the length and breath of Python language. It introduces more concepts that can be pursued further which I really like, especially for data science.

Read Less

Get Verified

Complete The Python Workshop to unlock your Packt certificate.

Unlock your own digital certificate by completing all activities. Designed to be easy to share with potential employers on LinkedIn, as well as other popular social media channels.

Take A Step Forward

There has never been a better time to start learning Python.

  • Free

    FreeThe Python Workshop

    Unlock one year of full, unlimited access!
    Learn for Free

Already Know Python?

Don't worry, we've got your back with other languages too!

Show me my options!