Want to learn Python "on the job" whilst building an exciting course project? This course is for you.
This is a highly practice-oriented Python course that teaches you Python from scratch - no prior programming experience required.
Want to learn Python "on the job" whilst building an exciting course project? This course is for you.
This is a highly practice-oriented Python course that teaches you Python from scratch - no prior programming experience required.
Python is THE most trending programming language you can learn these days.
It's very popular because it's easy to learn and use, runs on all operating systems and allows you to build a broad variety of programs: Be that web applications, desktop applications, utility scripts or using it for data science and machine learning.
In this course, you'll learn Python from scratch - and you'll do so whilst building your own Blockchain and Cryptocurrency. These are of course also highly trending topics and not a lot of people understand what a Blockchain really is. As a nice side-effect, you will know how a Blockchain works once you completed this course. It's an exciting course project that allows you to learn and apply Python to something you know and you can use.
Why Python?
As written above, Python is both easy-to-use and extremely versatile and powerful at the same time. Certainly not the worst combination. If you check it on Google trends (and compare it to other programming languages), you'll see that it's very popular these days.
It's being used by almost any important company - be that Google, Amazon or Facebook. It's used to run web applications, scripts, desktop programs and machine learning algorithms. This course sets the basics for all these use-cases.
Why Blockchain?
I believe that you learn something best if you directly apply it to a real-world project. And the Blockchain technology is an exciting trend which is there to stay. In this course, you'll learn a lot about the core concepts of the Blockchain and you'll see how Python can be used for the many aspects that make up a Blockchain and Cryptocurrency.
In my opinion, a perfect course project is challenging, interesting, something you know from real-life but also not overly complex. And that's all the case for the Blockchain. It poses some nice challenges where a lot of different Python features can be used to overcome them. It also is something we hear about all the time and yet no one knows how it works. And we can dive into the core Blockchain concepts without spending 100+ hours working on it.
Who's teaching you?
My name is Maximilian Schwarzmüller and I'm a freelance developer. My focus is on web development but I've been working with Python for many years. It's actually one of the first languages I started with when I was 13. I'm the creator of many 5 star bestseller courses here on Udemy and I love diving into new technologies. That's why I had to dive into this whole Blockchain thing when it became more popular and why I chose it as a project for this course.
I can't wait to welcome you on board of this course and I hope you'll enjoy it just as much as I did creating it. :-)
What's in the course?
Great question. Here's a brief summary:
A summary of Python and the Blockchain technology
All the base Python syntax you need to know (variables, operators, functions, ...)
Loops and conditional statements
More complex data structures like tuples or dictionaries
A closer look at built-in functions and the standard library Python ships with
String manipulation
How to work with files
Error handling
Debugging
Object-oriented programming with classes and inheritance
Internal & external modules (packages)
How to spin up an Http server with the Flask package
Handling Http requests (sending & receiving)
And more.
What are the course prerequisites?
NO prior programming knowledge is required
Very basic knowledge about how a computer works will help you though (but can also be built up whilst you're going through the course)
Is this course for you?
It's for you if
You want to get into programming => Python is a great "first language" since it's easy to learn and very versatile
You want to broaden your horizon => Are you a web developer? Want to learn something new? Here you go.
You're interested in Python for web development => This course will teach you Python in general but there are two modules where we'll also dive into web development a bit
You're interested in the Blockchain technology => You'll learn the core concepts of it as a side-effect of this course.
You know Python but want to practice it => The course project is challenging and taken from real-life - there probably is no better practice
Does that sound good to you? I'd be honoured to welcome you in this course. :-)
Let me introduce you to this course and to what you'll learn inside of it.
Let's dive into the most important question first: What is Python? In this lecture, we'll take a closer look.
With the theory out of the way it's time to dive into Python. For that we first have to install it so let me guide you through the required steps!
In this course we'll use Python 3 - here's how to run it.
We installed and Python and we are ready to go, so let's actually write our first Python code!
We already wrote our first Python code, but the course comes with a special project where we will be able to apply our new knowledge - The Blockchain. Let's have a closer look at that now!
You know what Python is and how the Blockchain theoretically works but what does the course actually offer you? This lecture will answer that question.
Python is of course not the only programming language you can dive into. Let's take a closer look at some alternatives you have.
Python comes with two different versions available on the market. Let me compare these two versions and show you why learning the latest one, as we will do it throughout the course, is definitely not a bad idea.
There's more than one way of taking a course. Let's find out how you can get the most out of this course in this lecture.
Attached to this lecture, you find the module source code. Inside of the lecture, you can find some helpful links.
Let me introduce you to this module and to what you'll learn inside of it.
Before we start setting up a local environment, let's have a look at the command line, the "REPL", once again. What is the REPL, how does it work and which data types do we actually have in Python?
Variables are a very important core concept not only in Python but in any programming language. Variables are data containers defined by us which allow us to store information in it. Time to find out more about these!
We will use numbers in our Blockchain, so let's see which numbers are supported in Python and how we can work with these!
Operators are very useful when writing our code as they allow us to add, subtract, multiply and divide data in our code. Let's have a look at how we can manage these arithmetic operations in Python!
We understood the basics about numbers but there is one special behaviour that we should also have a look at before we continue: Let me show you how the binary system our computers work with impacts the result of certain calculations!
In addition to numbers, we can of course also work with strings in Python. Fortunately these are really easy to use, so let's have a look!
Numbers and strings are fine but we want to build a Blockchain right? For that we will create a list or an array as you might know it from other programming languages. Let me show you which values lists in Python can hold and how we can access these list items!
Typically you won't hardcode your list items, so we need a way to dynamically add and delete list items. Let me show you how this can easily be done in Python with special built-in functions - ".append" and ".pop"!
The very basics are set - now it's time to work on the Blockchain! Let's leave the REPL for the moment, use a real development environment and start building our Blockchain. But what do we want to achieve, how should our Blockchain work?
For our local environment we want to write code in text files. An IDE (Integrated Development Environment) will make writing code a lot easier and a lot more fun. Let me show you how to get started with Visual Studio Code, the IDE I'll use throughout this course, in this video!
Functions are a very important core concept of any programming language as they allow us to define code which is executed whenever we want. Let me show you the syntax of functions in Python and let's also apply some functions to do the first steps in our Blockchain.
What are "Blocks" in a Blockchain?
We started adding values to our Blockchain, but until now we always refer to the first value in our list. Let me show you how we can easily access the last item in our list, because to make our Blockchain work correctly we need to be able to do so!
We understood how functions work in general but they can do more: Functions can receive arguments. Let me show you why arguments are an important feature of functions and how such arguments can be a big help in our Blockchain!
Let's have a look at another powerful feature of functions: The "return" keyword which allows us to return any value once our function gets called. Let's then also add this keyword to our Blockchain!
We already learned how to use function arguments but we can also use default arguments. These will be used if you call a function without passing the data for that specific argument. Time to find out more about that in this lecture!
We saw that functions are really powerful, but there is one last important feature we should understand: Keyword arguments (kwargs). These arguments allow us to call a function in a different, more flexible way, so let's see why kwargs can be helpful in our Blockchain!
The Blockchain evolves, but wouldn't it be great if the user could actually enter values? Let's see how we can easily implement that feature by adding the "input" function (a special built-in function) to our code!
Currently, we are repeating ourselves as we call the same code again and again. Once we dive into loops in the next module this issue can easily be fixed but we can already improve our code at this stage by creating an additional function. Let's do this!
We achieved a lot up to this point and we implicitly used a special concept: The Variable Scope. This defines where our variable is available in our code, anywhere or only inside the function where it was defined. Time to dive deeper into that!
A lot of the basics were covered and we'll dive a lot deeper throughout the course. In addition to that it's always worth to have a look at the official docs so let me quickly guide you through these!
We had a look at the PEPs and saw that Python comes with best practices regarding the way we should comment our code. Let me show you how to add comments to your code and let's also have a look at Doc Strings.
When working in Python, you might end up with relatively long code. Adding line breaks can be very helpful to bring more structure into your code, so let me show you how to add these!
Let me wrap this module up and summarize what you learned thus far.
Loops allow us to repeat code: We write the code once and then we define conditions to run the code multiple times. Let me show you how we can work with loops in Python!
Time to add a "for" loop to our Blockchain to loop through our list items!
We added the "for" loop, but what about the "while" loop? Let's use this loop to create a user interface which offers multiple options for our users to choose from.
How to close the REPL properly.
Besides loops, conditionals are another core concept of each programming language. Time to have a look at "if-else" to understand how we can use it to execute different code depending on the user input!
The theory behind "if" is clear now, so let's implement it in our Blockchain!
The "while" loop, including the "if-else", statement only supports two cases at the moment. But what if the user adds invalid input or if we want our users to be able to quit the loop? For that, we need "elif", so let's dive into that!
What if we want to quit the loop upon user input, so before the loop is actually finished? Then we need the "break" keyword. Let's have a look at this and additionally at the "continue" keyword which allows us to skip one iteration only!
We had a closer look at loops and conditionals throughout this module, so let's use this knowledge to make our code a bit leaner and cleaner!
We had a look at Boolean Operators already, but we didn't have a look at all of these. Specifically, let's find out more about "!=", "is" and "in" in this video!
We understood the "is" and "in" keywords, but what if we you just want to check the opposite? Then we can add the "not" keyword, so let's see how this works!
Time to have a look at three additional important features we should know: Let's see how two of these - "and" & "or" - work in this lecture!
In addition to "and" & "or", grouping conditionals is also very important to ensure our conditionals work correctly. Let me show you how this works!
In case you already know other programming languages you might also know the "switch" statement. Can we also use this in Python?
At the moment we can manipulate past transactions in our Blockchain, which definitely shouldn't be possible. Let me show you how we can prevent such manipulations!
It's important that we can ensure the validity of our blockchain. Here's the first important building block.
We added the Blockchain verification, but I also wanted to show you an alternative to the "break" keyword we use in our code. Let's see how we can add conditions to a "while" loop to get rid of "break"!
One additional and good to know feature of "while" and "for" loops is the possibility to specify an "else" case. Time to have a look at that in this lecture!
"for" loops in other programming languages come with a built-in index function. Unfortunately Python doesn't ship with such a feature, but turns out that the "range" function can also get us there!
Before we dive deeper, let's have another look at the general logic of a Blockchain and how transactions should be handled in it. What information should be transferred, how should it be transferred and what about the miners of a new block?
Which data structures do we have? In the end, all data structures will be iterables so let me give you an overview of iterables in this lecture!
The core data structures/ iterables are clear now, but which data structure should we use for our Blockchain? Let's ensure to choose the right one!
Let's go back to our Blockchain and work on our transactions. For that, dictionaries and tuples will be really helpful, so time to have a look at these now!
Transactions are a crucial part of a cryptocurrency blockchain. Here's a brief summary.
We added the tuple to our Blockchain, but now we need to pass on that data. We have multiple ways to do that, unpacking the tuple is one of our options!
The transactions are one important core concept of a Blockchain, the other one is the actual mining of a block. Time to implement the block data structure to our Blockchain!
Let's continue the work on our mine-block functionality. To make our Blockchain work correctly, we need to be able to add the hash of the previous block to our new block. Time to learn how we can do this!
We implemented a basic hashing algorithm, but there is a nice alternative to that. List Comprehensions! Let me show you what these are and how we can use them to create our hashing algorithm.
We understood List Comprehensions, but what are Dict Comprehensions then? Although we won't use them very often, let me also quickly introduce you to these!
Back to List Comprehensions, because wouldn't it be great if we could combine these with "if"? Turns out this is possible!
With our newly gained knowledge, we should go back to our Blockchain now and improve our validation logic!
One feature we didn't consider so far is the fact that we want to manage a list of participants - so senders and recipients. Because in the end, our Blockchain should become a network, so let's work on that list now!
We can output our participants, but wouldn't it be great if we would know how many coins each participant has? Additionally, we have a little flaw in our code as we never reset our transactions. Time to change that!
Our transaction structure works now, but one very important thing is missing: We don't have any coins in our system up to now! We should definitely change that so let's make sure that miners receive a reward for mining a block. And this reward should be coins!
We added the mining reward and we can get the balance for our participants but we should also make sure to verify our transactions!
The Blockchain takes shape, time for some theory now: Lists in Python are copied by reference and not by value - what does that mean and which implications does this have for your code? Let me explain the difference between copying "by reference and "by value" in this lecture!
We used the "range" selector to copy our list. Let's have a closer look at some additional application areas of this selector!
One more thing about "by reference" vs "by value": What happens if we have a complex data structure which includes other complex data structures? Then we need to understand the difference between shallow and deep copies!
Do you remember the "is" & "==" boolean operators from the last module? How do these behave in relation to "by reference" and "by value"? Let me show you an example to make sure we understand this!
Let's go back to the official docs: There we can find a lot of methods that we can use to call a list and manipulate it. Let's apply some of these methods and see how we can use them in practice.
Two more important functions before we are almost done with this module: "all" & "any". Let me show you how these work and what we can use them for in this lecture!
We learned a lot about iterables/ data structures. Let me summarize what we learned about these and what we can use them for!
Before we dive deeper, let's have a look at the differences between strings and lists. Both might seem equal in some cases, but actually both are totally different data structures.
With the differences between strings and lists understood, it's time to have a look at a very important string method: "format". As the name indicates, this method helps us to output nicely formatted text, definitely something very useful for our Blockchain!
What if we have two equal characters in our string with two different meanings, a single quotation mark (') for example? How can we tell Python when the single quotation mark is supposed to open/ close the string and when it should behave like a normal single quotation mark does, for example when writing 'I'm Max'?
You're probably using Python 3.6 and thankfully this version comes with a very convenient way to format strings. Let me show you which way this is in that lecture!
With the basics of string formatting being set, it's time to also apply it to our Blockchain. The balance output for example is not formatted nicely at the moment, so let's work on that!
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.
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.