Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
A Python Tale • A Relaxed Programming Course for Beginners
Rating: 4.9 out of 5(11 ratings)
1,184 students

A Python Tale • A Relaxed Programming Course for Beginners

The friendly Python programming course where you'll actually understand what's going on
Last updated 4/2024
English
English [Auto],

What you'll learn

  • Understand the fundamentals of writing a Python computer program
  • Understand the mindset needed for communicating with a computer through a program
  • Learn key foundational topics, including loops, defining functions, conditional statements, data types and data structures
  • Gain confidence to write programs independently

Course content

5 sections90 lectures8h 41m total length
  • Let's Make a Start2:39

    Welcome to Python

    • Welcome to coding. Welcome to Python. And Welcome to The Python Coding Place. Hopefully you'll stick with coding and Python, and also with The Python Coding Place

    • The best course for you is the one that you connect with most, the one that delivers content in a tone and style that suits you. If my style is that style, then we'll get to know each other well over many hours

    • No potten plants and fancy bookcases in the background of my videos. The star of the show is the Python code we'll write together.

    • When I record these videos, I imagine sitting in a quiet, comfortable coffee shop where we're talking casually about Python coding.

    Try out a few videos, and if you like them, just keep going…

  • What's Coding? Here's My View…3:58

    What's Coding?

    • Yes, I know you know what coding is already. But bear with me, listen to how I see coding.

    • We communicate with other humans all the time. Knowing a common language with our audience is important, but there's more to human-to-human communication.

    • Coding is communication with a computer. We want to convey our ideas of what we want the computer to do to the computer.

    • And yes, we also need a language to translate our ideas into something the computer can read. That's Python in this case.

    • Programming is a mindset—learning to think in a way that's compatible with computers.

  • Installing Python and Other Tools6:46

    Installing the Software

    If you already have a setup to code in Python that you're happy with, keep it. Don't let anyone tell you "You should use this editor and this configuration to code". Find what you're comfortable with.

    But if you're new to coding, then you can follow these steps to install Python and an editor. I'll use PyCharm in my videos, so you can use the same software if you don't already have a preferred editor.


    Install Python

    First, you'll need to install Python, the language.

    • Go to the Python home page (link in resources)

    • Hover on the Downloads tab and click the button to install Python. This link will download the latest version, which is the one you want to use.

    • Once the download is complete, run the installer. You can choose all the default options when you're asked any question during installation.

    You don't need to run anything. As long as Python is installed on your computer, you can move on to the next download and installation.


    Install PyCharm Community Edition

    The language is not enough. You need an editor to write code and manage your projects. Although Python comes with a basic editor, I'll recommend you use one of the standard IDEs (Integrated Development Environment)—that's a fancy word for an all-in-one software for your coding.

    • Go to the Jetbrains homepage and look for PyCharm's download page (link in resources)

    • There are two versions of PyCharm on this page. Don't choose the more prominent one, the Professional Edition, since this required a paid license. Instead, scroll down to get PyCharm Community Edition, which is free and more than enough for your current.

    • Once the download is complete, run the installer. You can again choose all the default options when you're asked any question during installation.

    Once you've installed PyCharm, launch it, again choosing the default options during any set up steps presented to you.

    • Create a New Project. A project is a folder with all the files that belong together. I recommend you create a single project for all the lessons we'll work on in this course. Don't create a project for each lesson!

    • You'll be asked to choose your Interpreter. PyCharm wants to know how you want Python set up. Go with the defaults again. This will create something called a Virtual Environment (don't worry about what this is for now) using the version of Python you have just installed. In future, you may have more than one version of Python installed on your computer and you can use different ones for different projects.

    • And you're in! Now, From the File menu, choose New... (not the menu item that says New Project, since you're already created a project, but the one the simply says New...)

      • From the window that comes up, choose Python File (not the option that just says File)

      • If you don't see any options in the little window that pops up on your screen, make sure your project/folder is selected in the Project sidebar on the left (you may need to open the sidebar first) and then try again.

      • Name your file anything you want, and you're ready to code

  • Finding The Goblin • Introduction to the project2:54

    Introducing the first project

    • Nothing much to say in these notes for this first video. Before we can start coding, we need to understand the game. But this is an easy game to understand…

  • Talk To Me • `print()`, `input()`, and strings6:57

    Passing information between program and user

    • Remember you have two hats: the programmer's hat and the user's hat. When you have the programmer's hat on, you know what's in the computer program. But you should also put the user's hat on when running your code. The user doesn't know what's in the code.

    • The program often needs to show some information to the user. You can use the `print()` function for this. It's a one-way form of communication: from program to user.

    • You can also use `input()` which is a two-way form of communication. The program sends text to the user but the user can also type something and send it back into the program. The program then has access to whatever the user of the program wrote.

    • You create a string when you use quotation marks in your Python code. You can use single or double quotation marks. The text inside a string is something for the human to understand. The words in a string are not Python commands.

      • String is short for a a string of characters.

  • Store This In A Box • Variables4:35

    Storing information

    • A computer program deals with data. There's information that you need to use in different parts of the program.

    • You can assign data to a variable name using =

      • You can choose (almost) any name for your variable. This goes on the left of the equals sign.

      • Then you can put the information you want to store on the right of the equals. This could also be a function that gives some information back when it runs, such as `input()`.

    • You can think of this as a box which stores things. The variable name is the label you use to identify the box. We'll talk more about these boxes later in this course.

    • f-strings: We can format strings by adding information stored in the program within a string.

  • Sticking Strings Together • Concatenation5:05

    Concatenating strings

    • There are many ways of sticking strings together into one string. The simplest is to add them using a +, but this is only suitable for simple concatenations.

    • The modern way of dealing with these situations is to used formatted strings, or f-strings. You can put an f before the quotation marks to turn it into an f-string, and then add Python variable names or other statements in curly brackets {} withing the string.

    • There's also the `.format()` method you can use with strings. I used the term "method" there. Don't worry about what this is for now. It's a function that performs an action on a string in this case.

  • Deciding What To Do • `if` statements14:01

    Making decisions: `if` statements

    • Often, you need the computer program to make a decision. This is not a decision you, the programmer, can make when writing the program. It's a decision that only the program can make while it's running.

    • You can use an `if` statement for this. The keyword `if` must be followed by something that Python understands as true or false. In Python, there are built-in constants `True` and `False`.

    • The block of code that follows the `if` statement will only run if the condition following `if` is true (I'll phrase this differently: it needs to be something that Python understands as true. We'll get back to this wordier version later)

      • The lines that "belong" to the `if` statement are the ones which have an indent—a space at the beginning of the line.

    • There's a difference between = and == in Python:

      • = is used to assign data to a variable name. It stores information

      • == asks the question "are the two things on either side of the == the same?". It wlil say `True` if they are and `False` if they're not.

    We'll revisit the `if` statement at the end of this Chapter.

  • Squashing Your First Bug13:49

    We have a bug • Introduction to data types

    • It doesn't work! The code never tells us we won even when we put the correct number.

    • `input()` gives us a string back, even if the user types in a number. So if you type the number 3 in your program, this will return "3", the character not the number.

    • So, if you compare "3" with 3, Python will say they're not the same. "3" == 3 gives back `False`.

    • Every bit of information in a program has a certain type. The data type of everything is important since it affects many properties and actions we can do.

      • "3" and "Stephen" are strings

      • 3 and 42 are integers, whole numbers

      • 5.5 and 2.53 are floats, numbers which are not whole numbers!

  • On and on • `while` loop5:49

    `while` loop

    • Often, you'll need to repeat a block of code several times. You need a loop for this. One type of loop in Python is the `while` loop.

    • In its simplest form, you can write `while True`, which repeats the block of code that comes after this statement forever.

    • We see the colon and indents again. We used colons and indents with `if` and now againn with `while`. We'll see the colon and indent pair often in Python.

  • On and on but not forever • more `while` loop6:47

    Stopping the `while` loop

    • We introduce the Boolean data type. This is something that can only have two values: `True` or `False`.

    • It's useful in many instances when we need to store information that can only have one of two values.

    • We can use it as a "switch" to turn things on or off. We often use the term "flag" for this, but I like to think of it as a light switch you can turn on and off.

    • You can use a Boolean to turn the `while` loop off when a condition is met, such as the player guessing the answer.

  • Fetching more Python stuff • Importing modules5:54

    Importing modules

    • When you open a new Python script, you only have access to a limited number of functions and keywords. But Python has a large number of tools you can use.

    • You can import modules using the `import` keyword.

    • I'll talk about an analogy later on in this course which I like to use. Here's a preview:

      • Imagine a large old-fashioned library with lots of books covering the walls

      • Each book has lots of Python words you can use. And each book has a theme

      • You can bring these books into your program using `import`. Then, you'll have access to whatever is in this book within your program.

    • One such module is the `random` module which has lots of tools to deal with randomness, such as creating random numbers.

  • Finishing Touches8:47

    Finishing touches

    • We were using the number 5, for the number of doors in the game, in several places in our code. We want to avoid this, so we create a `number_of_doors` variable, which contains 5, or any other number of doors.

    • We add some comments to annotate our code.

    Happy goblin-hunting!

  • A bit extra: More on `if` statements4:24

    `if`, `elif` and `else`

    • You can have an `if` statement by itself. So the code in the `if` block will happen if `if` is followed by something that Python understands as true but it won't happen otherwise.

    • You can also add more conditions after `if` by using `elif` statements. This stands for "else if". So if the first `if` statement is false, the next condition is checked. And you can have as many `elif`s as you want following the first `if`.

    • You can also add an `else` clause at the end of all the `if` and `elif` clauses. The `else` doesn't need any condition. It catches all the situations that are not covered by `if` or `elif`.

    • You must have an `if` statement, but you don't always need to have `elif` or `else`.

  • Final word2:40

    Store. Repeat. Decide. Reuse.

    • A lot of what happens in a computer program falls under one of these crude categories:

      • Store: Storing information to use later in the program, such as by creating variable names and assigning data to these names.

      • Repeat: Repeating a block of code several times, such as by using loops.

      • Decide: Your program will need to make decisions on how to proceed. You can get the program to make decisions using `if` statements, for example.

      • Reuse: We'll come to this later in this course…

    If you want to read more than just these short bullet points, you can look at The Python Coding Book. I'm broadly following the material in that book. Most of what we've discussed in this Chapter can be found in Chapter 1.

  • Exercises for Section 12:05

Requirements

  • No prior knowledge of programming is required.
  • You'll be guided on how to access Python during the course

Description

A different way of learning to code in Python. This course takes you through the basics of programming in a teaching style that's friendly and relaxed.

The focus is on clarity and really understanding what's going on.

I've been teaching Python coding for a decade and I'm the author of The Python Coding Book (just ask Google for a "python book"!)

My teaching style is different. Try out the first few lessons and if it's your style, then we'll be together for a many hours.

No prior experience of Python or coding is required. This is a beginner's course.

Or perhaps you're not a beginner, but you've done a bit of coding in the past but didn't carry on. It wasn't you, it's likely you didn't find the resources that speak directly to you. I can't promise my style is what you're looking for, but you'll know after the first few lessons!

In this course you'll learn:

  • How to apply the key principles and mindset for communicating with a computer through programming

  • How to repeat blocks of code using `for` loops and `while` loops

  • How to store data using variables and using various data types

  • How to define your own functions to re-use code

  • How to use data structures including lists, dictionaries, and tuples

  • How to read data from external text files and spreadsheets and write data to these file formats

  • How to apply best practices when coding

This course will teach you all the fundamental tools, of course, but more importantly, it will teach you the right mindset for programming. This is just as important as learning all the programming techniques—if not more important.

And you'll also meet Monty, the main character in an analogy I love which I'll share with you in this course—trust me, this analogy alone is worth your time as Python programming will make so much more sense…

Who this course is for:

  • Beginners starting to learn to code using Python
  • Students who have tried to learn in the past but gave up!