Python Full Course for Beginners (13 Hours) – From Zero to Hero

Data with Baraa www.youtube.com

Brief Summary

This comprehensive Python course, taught by an industry expert, aims to equip individuals with a strong understanding of Python, from basic principles to advanced applications. The course uses visual aids and real-world examples to simplify complex concepts, making it accessible to beginners while providing valuable insights for experienced programmers. The curriculum covers key areas such as data types, control flow, data structures, and functions, ensuring participants can confidently apply Python in various domains.

  • Covers Python from basic to advanced level
  • Uses visual aids and real-world examples
  • Focuses on data types, control flow, data structures and functions

Python Course Introduction

This course distinguishes itself through its teaching approach, which focuses on explaining the inner workings of Python using animated sketches and visuals, rather than just presenting code. The course is designed for anyone aiming to master Python, regardless of their background, and assumes no prior knowledge, starting with the basics and progressing to advanced topics. By the end of the course, students should feel confident in their ability to use Python in real-world projects.

Python Learning Roadmap

The course is structured into thinking layers rather than random topics, beginning with foundational knowledge of what Python is and how it works, followed by basic tools like printing, variables, and input. It then moves into data manipulation with strings and numbers, covering transformations, cleaning, validation, and analysis. The next section focuses on controlling code execution through boolean types, logical operators, conditional statements, and loops. The course culminates in data structures (lists, tuples, sets, dictionaries) and functions, teaching reusable logic and professional Python development practices.

What Is Python & How It Works

A programming language allows instructions to be given to a computer in a way it understands, bridging the gap between human and machine communication. High-level languages like Python are designed for human readability and ease of use, while low-level languages are closer to machine code but harder for humans to understand. Python acts as an abstraction, simplifying the complexity of machine languages and making programming more accessible.

Installing Python

To install Python, one should visit python.org, download the latest version, and ensure that "Add python.exe to PATH" is checked during installation. After installation, the terminal can be used to check the version by typing python --version. For writing Python code, Visual Studio Code is recommended as a free, lightweight code editor, enhanced with the Microsoft Python extension for features like syntax highlighting and error detection.

Comments & print()

Comments are lines of text in code that Python ignores, used to explain the code's logic for human readers, enhancing understandability and maintainability. They can be single-line (using #) or multi-line (using multiple # or triple quotes). The print() function is a built-in Python function that displays text or results on the output screen, serving as a primary means of communication from the code to the user. It can use single or double quotes, and special characters are escaped using backslashes (\).

Variables

Variables are names used to store values for later use in a program, acting like labelled boxes holding data. Python manages variables in memory, assigning values and updating them as needed. Variables make code more dynamic and easier to maintain, allowing for changes to be made in one place that affect the entire code.

User input()

The input() function is a built-in Python function that allows programs to receive input from the user. It displays a message prompting the user for input and then waits for the user to type something and press Enter. The entered value can then be stored in a variable for further use in the program.

Python Data Types

Data types classify values in Python, determining how they can be treated and manipulated. Python automatically detects data types, storing them in memory with a variable name and a data type label. Common data types include integers (int), floating-point numbers (float), strings (str), and boolean values (bool). Python uses data types to prevent incorrect operations and to understand how to process data.

String Basics & Transformations

Strings are text values enclosed in single or double quotes, and Python provides numerous tools for working with them. The str() function converts values to strings, while special characters can be included using backslashes. Common string operations include searching, validating, and case conversion.

Indexing & Slicing

Strings are sequences of characters, each with a position or index. Indexing retrieves a single character using its position, while slicing extracts a substring by specifying start and end indices. Positive indices count from the left, while negative indices count from the right.

Search, Validation & Case Conversion

String methods like startswith(), endswith(), and the in operator are used to search for specific substrings within a string. Case conversion methods like lower() and upper() transform the case of strings, while methods like isalpha() and isnumeric() validate the content of strings.

Integer & Float, Types, Math

Python supports numeric data types such as integers (int) and floating-point numbers (float). Basic math operations can be performed using operators like +, -, *, /, and %. The int() and float() functions convert values between these types.

Rounding, Random, Validation

The round() function rounds numbers to a specified number of decimal places, while the abs() function returns the absolute value of a number. The random module generates random numbers, and the is_integer() method validates if a float is a whole number.

Boolean Values

Boolean values (True and False) represent truth and falsehood, and the bool() function converts values to boolean. Boolean logic is fundamental for controlling code execution.

Comparison & Logical Operators

Comparison operators (==, !=, <, >, <=, >=) compare values and return boolean results. Logical operators (and, or, not) combine boolean expressions to create more complex conditions.

Membership & Identity Operators

Membership operators (in, not in) check if a value is part of a sequence, while identity operators (is, is not) check if two variables refer to the same object in memory.

If, Else, Elif

Conditional statements (if, else, elif) control the flow of execution based on boolean conditions. The if statement executes a block of code if a condition is true, else provides an alternative block if the condition is false, and elif allows for multiple conditions to be checked in sequence.

Nested & Advanced Conditions

Conditional statements can be nested within each other to create more complex decision-making processes. Proper indentation is crucial for defining the scope of each block of code.

Inline If & Match Case

Inline if statements provide a concise way to express conditional logic in a single line. The match case statement, introduced in Python 3.10, offers a structured way to match a value against multiple patterns.

For Loops

for loops automate repetitive tasks by iterating over a sequence of items. The loop variable takes on the value of each item in the sequence, allowing a block of code to be executed for each item.

Break, Continue, Pass

Loop control statements (break, continue, pass) modify the execution of loops. break terminates the loop entirely, continue skips the current iteration and proceeds to the next, and pass does nothing, acting as a placeholder.

For-Else & Nested Loops

The for-else construct executes a block of code in the else clause if the loop completes without encountering a break statement. Nested loops involve one loop inside another, allowing for iteration over multiple dimensions of data.

While Loops

while loops repeat a block of code as long as a condition is true. They require careful management of the loop variable to avoid infinite loops.

Lists Overview

Data structures are ways of organising, managing and storing data in Python so that it can be used efficiently. In Python, there are four built-in data structures: lists, tuples, sets and dictionaries.

Creating & Accessing Lists

Lists are created using square brackets [] and can contain items of different data types. Items in a list can be accessed using indexing, with the first item at index 0.

Unpacking & Analyzing

Unpacking assigns list items to individual variables, while functions like max(), min(), sum(), and len() analyze list content. The all() and any() functions check if all or any items in a list meet a condition.

Add, Remove & Update

The append() method adds an item to the end of a list, while insert() adds an item at a specified position. The remove() method removes the first occurrence of a value, and pop() removes an item at a specified position. List items can be updated by assigning a new value to a specific index.

Sorting & Combining

The sort() method sorts the list in place, while the sorted() function returns a new sorted list. The + operator combines two lists, and the extend() method adds the items of one list to another.

Iterables & Filtering

Iterables are objects that can be looped over, and iterators are objects that produce values from an iterable one at a time. The filter() function creates a new iterable containing only the items from an iterable that meet a specified condition.

Lambda & List Comprehension

Lambda functions are anonymous, single-expression functions that can be used to define custom logic for map() and filter(). List comprehensions provide a concise way to create new lists by transforming and filtering existing iterables.

Tuples

Tuples are ordered, immutable collections created using parentheses (). They are similar to lists but cannot be modified after creation, making them suitable for storing fixed data.

Sets

Sets are unordered collections of unique items created using curly brackets {}. They do not allow duplicates and are optimised for fast membership testing and set operations.

Dictionaries

Dictionaries are collections of key-value pairs created using curly brackets {}. Keys must be unique and immutable, while values can be of any data type and can be duplicated. Dictionaries are accessed using keys, not indices.

Functions Introduction

Functions are reusable blocks of code that perform specific tasks, promoting code organisation and reducing redundancy. They are defined using the def keyword and called by their name followed by parentheses.

Function Parameters & Return

Parameters are names for the inputs a function expects, while arguments are the actual values passed during a function call. Functions can return values using the return keyword, allowing the result of a function to be used in other parts of the program.

Types of Python Functions

Functions can be categorised by their purpose: action functions perform tasks with side effects, transformation functions manipulate data, validation functions check data validity, and orchestrator functions control program flow by calling other functions.

Writing Clean Functions

Clean functions adhere to coding standards like snake case for naming, clear descriptions, and the use of docstrings. They avoid printing directly, use local variables to prevent modification of parameters, and may include type hints for parameters and return values.

Summarize any YouTube video in seconds

Get summaries like this one for any video, in your language, with the free Summ app.

Download on the App Store
Get it on Google Play

Transcript

YouTube Transcript Generator

0:00 Hey friends and welcome to this very unique course to master Python. And of course you might ask what makes it unique and different from all other Python courses. First I will not only share my screen and start showing you how to write Python code and hope that you're going to remember it tomorrow. Instead I'm going to show you how Python actually works behind the scenes. How Python executes your code step by step. How your data and values moves inside your code. How the functions behave. how decisions are made. So, I'm going to explain everything and break all the complex concepts into very simple animated sketches and visuals. Why this is very important? Because visuals and sketches, they stick in our head way longer than code and text. Because we are simply visual creatures and we remember images longer than text or

0:49 code. Once you understand how things works behind the scenes and the logic, then writing a code going to be very simple for you. Now the second reason why this course is unique, well it is taught by me. My name is Barra and I have more than 17 years experience working with Python and real industry projects. I led one of the biggest data and AI project at Marcus Spence and other large companies. That means you are learning from someone that were in the industry for many years using Python. It's not only theory. You're going to learn how professional things and how we use Python in real world projects. And now who is this course for? Well, it is for anyone who wants to master Python. Whether you are a data analyst, data engineer, scientist, web, game developer or you are just students that want to learn Python for the

1:34 future. So, it's going to be very generic for any career and role. And as well, I have designed this course for total beginners. So, I assume that you might only heard about Python and that's it. I'm going to take you step by step from the very basics of Python and keep progressing into advanced Python topics. So by the end of this course, you're going to feel very confident using Python in real projects. So now my friends, as you can see, I'm really excited about it. >> Very very excited because I enjoyed really every moment making this course. If you are ready, then join me. It's going to be amazing. Now let's go. All right, friends. Now I designed this course in very specific way so that you don't just jump randomly between topics but to make you think in Python. So

2:22 instead of having like chapters I build it in thinking layers. So now let me show you quickly what I mean and the road map. So now of course the first step you need to build the foundations before writing any code. I want you really to understand what is Python, why we even use it, how does Python works behind the scenes and after the theory, you're going to learn the basic tools that you're going to use everywhere in Python like the printing variables, input, comments. Those tools are very simple and you're going to use it in daily basis. Now, after the foundations, we have two chapters with one goal. You will learn how to work with the data. So you're going to learn all the tools that you need to work with the two most common types in real words. We have the

3:07 text, we call it strings and as well the numbers. Now why we need this? Because in projects we have to do a lot of things with the data. So we transform it, clean it, change the format, validating the data, manipulating things, searching, analyzing, extracting. So you're going to learn all those tools to make you ready to do any task about working with data. And now after that we're going to move to something deeper. Here we have three chapters that all focus on one idea. How to control the execution of your Python code. In the first chapter you will learn how Python understands the true and false. We call it the boolean types. And then you're going to learn how to build logic, how to build conditions. So you're going to learn all the operators

3:53 and tools in order to build the brain inside your code. After that, we're going to learn the conditional statements. So here you're going to learn how to make your code decide based on the logic using statements like if else. And then the last chapter in this category, we're going to learn about the loops. And here we have mainly two types, the for and the while. So here you will learn how to automate things instead of writing the same thing over and over. So with those three chapters, you're going to learn how to have the full control of your code. And now the next chapter we have the data structures. This is going to be the most important chapter and as well the biggest chapter in the whole course. Now you already learned how to work with data with single values. But in real words data come in collections. So they

4:42 come in groups. That's why you have to learn how to work with advanced data types like the lists, tpples, sets, dictionaries. And of course here you will be geared with all tools that you need in order to work with those advanced types. So how to create, how to change, analyze, combine, how to split, how to iterate, filter, so many important topics. And by the way, this is very important for job interviews and as well for real projects. Now the final layer, we have the functions. It's all about how to think like professional Python developers. So you have to learn how to design reusable logic, how to break complex problems into clean pieces and of course we're going to learn that using functions. So you're going to build your own machine inside your code.

5:31 So my friends, this is the whole road map. If you go through all the layers step by step, you're going to have enough confident to solve most of Python tasks. And of course, not only by memorizing the syntax, but by understanding how Python works. I hope that you are excited about this because I am. Let's start with the foundations with the first chapter and we're going to start with very simple question. What is Python? Let's go. Okay. So now [music] let's start with basics. What is programming language? So now imagine that you want to give your computer a task and you say hey computer calculate 5 + 5. Well your computer will not understand what is exactly you're talking about and nothing going to happen. So we cannot use the natural human language in order to give tasks for your PC. So now instead of that we

6:18 have to give the instructions in a language where the computer understand it. We write a short piece of code like for example here in Python print 5 + 5. Now the computer going to understand the instruction and give us a result 10. So a program it is like set of instructions that is written in a language the computer can follow. But my friend not all languages are the same. Some are made for people and others are made for machines. So now at the top we have the natural language like you say hey please calculate 5 + 5 and we have a lot of natural languages we have the English, Spanish, Hindi they are easy for us but far too complex for computer to understand. Now moving on then we have the highlevel languages. So they are programming languages but they are made for human because they are very simplified, logical and really easy to

7:07 write and to read. And we have a lot of languages like Python and JavaScript. They are high-level languages. And now next we are going lower. We are going to the low-level languages. Programming languages can talk directly to the machines. But they are really hard for humans. It's hard to read, to write, and as well to understand. And here we have examples like the assembly and the C language. And now at the very bottom, we have the machine language. And this one is made of binary code, a combination of ones and zeros. And this is exactly what your computer can understand but it is impossible for humans to read it to understand it to write [music] it. So now if you look at these levels each step down it going to bring us closer on how the machine thinks and each step up it going to bring us closer on how human thinks. So now if you're looking at

7:54 Python the highle language it is closer to the natural language than the machine language. So that means it is really easy to learn and to write and it's like an abstraction that hides the complexity of low-level and machine languages. So it's like a bridge between both worlds. So this is exactly what are programming languages and what is Python. Okay. So [music] now I would like you to understand exactly how Python works. So let's say you open your editor and you start writing Python code and usually we write the code inside a Python file with the file extension of py. So here you are writing the source code. Once you run your code, the computer cannot immediately execute your instructions because it is really high level and the computer needs a lower level of the code. So what happens? There is

8:43 something called compiler in Python. It going to take your Python code and translate it to another code. It's called the pite code with the extension pyc python compiled [music] and this can happen automatically and you will not even notice it. So what happened here the compiler [music] of python going to translate the highle language the python code to a low-level language the bite code. So as you can see it's really hard to understand the bite code compared to the python code. So now our code is not yet executed, right? Python just did a translation. But now before anything to be executed, what can happen? Python might as well link some libraries. It is like pre-written chunks of codes that helps your code to do something specific like working with files, handling data and so on. Now, Python has everything the bite code, the libraries and now

9:32 Python can run your bite code using something called Python virtual machine. So it's like a software that can understand the bite code of Python and take care of running it. So the Python virtual machine going to finally converts your instructions into machine codes once and zero because this is the only thing that your computer can really understand. And once it runs you will see at the results whatever your program was designed to do. And now all those three steps compile, translate and execute we call them the Python interpreter. So it's like a toolbox that handles everything needed to [music] run a Python code. So again my friend you write Python code in a high language then Python compiles it and translate it into the bite code the low language and then the virtual machine going to take care of everything going to take your

10:19 bite code some libraries and then it going to run it at your computer to see the results. So this process happens every time you run a Python code and everything is of course automated and [music] behind the scenes. Okay, [music] so now let's talk about why we should learn Python in the first place. There are like too many programming languages out there. So why millions of people choose Python? So the first and most important reason is Python is very powerful and as well at the same time very simple. You can build really serious stuff with few line of codes. So if you compare like Java and Python, in Java or C++ you're going to write like a lot of lines in order to do a simple task compared to Python where you need only like one or two line. So as you can see Python is very simple compared to other programming languages.

11:07 Okay, moving on to the second reason. Python is used literally everywhere and you can use it in order to build everything. So you can use it to build websites, to automate tasks, to work with data, to build games and even control robots. So whatever direction you want to go in tech, you will find probably Python. Okay, moving on to the next one. One of the best things about Python is the community. You are my friend never alone. There are thousands of developers and experts like me sharing their knowledge in tutorials or they are like writing blog posts and as well developing and sharing free libraries, open-source projects in GitHub. And if you are stuck or have any complex task, I'm sure there is like someone already solved it and probably made a YouTube video or a GitHub repo about it. So this type of community

11:54 makes the language alive. And when it comes to AI, Python is leading the way. Almost everything you hear about today like Shbet, image generations, self-driven car models, it's built with Python [music] because Python has an incredible ecosystem for AI and machine learning. So my friends this means the programming language of AI is Python and if you are interested in the future then Python is the right language. And now because of all these reasons Python is one of the most in demand programming language in the world right now. If you check any job description in the tech world you will see everyone across all industries finance, healthcare, logistics, car manufacturing, everyone is requesting Python skill. So my friends Python is really easy to learn has incredible use cases. It is shaping the future with the AI. It has huge

12:43 community and it is amazing for your career. So this is exactly why millions learns [music] and works with Python. Okay. Now the first thing that we need to do is to go and download Python. So open your browser and go to python.org. And then we're going to go to the download section. And here you're going to see one big yellow button that says download Python. And then we have like a version. For me now it's like 3.13. You might see here like higher version that I'm showing now. And that's totally fine. So let's go and click on that. And then you will get like the installation. So let's go and click on it. And now very important before we start installing now. We're going to go and check this one. So we're going to say

13:28 add python.exe to path. It's just going to make your life easier. Trust me. So now let's go to install now and click on that. So with that we got Python in our PC. So now what we installed now is the full Python [music] engine. So we have like the interpreter, the standard libraries, the built-in stuff, all those basics that you need in order to run Python code at your BC. Okay. So now we have to check whether everything is installed correctly. So now go and search in your system for terminal and let's run that. Now here in the terminal type python then dash version. Let's go. And our system returns Python with the version. So if you get it like me that means my friends we have now installed [music] Python at our PC.

14:15 And now the [music] next question is where we going to write our Python code. And here we have two options. Either we're going to use a code editor or we're going to use an IDE. So a code editor it is like smart notepad for developers. So, you're going to have like some nice stuff like syntax highlighter, autocomplete, file navigations, many extensions and add-ons. And we have very famous editors like the visual studio code and Atom. And from the other side, we have the IDE, integrated development environments. This one is like heavier, more advanced than the code editor. You will get a debugger, compiler, version control, and many more heavy stuff inside it. And a very famous one is like the PyCharm and the Visual Studio. Be careful, it's not the Visual Studio Code. And now, of course, the question is which one we going to use. Well, we're going to go with the code editor,

15:03 Visual Studio Code. It is just free, lightweight that has more that we need in order to learn or work with Python. And I can tell you, my friend, this editor is not only like for beginners, for someone to learn a programming language. This one is as well for professionals. You're going to be using it in your projects. I use this editor as well for my real projects. So, now enough said. Let's go and get it. Okay. So now let's go and download Visual Studio Code. So we're going to go to code.visisualstudio.com. And once you are there you can go and click download for Windows. And if you are using Mac you can go to the docs over here and then to the setup on the left side and here you can see for Linux for Mac for Windows and if you go to the Mac you can see as well here the

15:48 downloads. So now go download and install Visual Studio Code at your PC. After installing the Visual Studio, we're going to go and open it. And now I totally understand if this is like little bit overwhelming. You have a lot of icons, menus, and stuff. But don't worry about it. I'm going to guide you like step by step. So now we have here like the basic Visual Studio, but we want to go and upgrade [music] stuff. We want to go and add like upgrades and power to our editor. And we can do that by adding extensions to the Visual Studio. Now, if you go to the left side, you can see here we have a lot of icons. One of them called extensions. So go and click on that. So now what we can do, we can go and search for add-ons and extensions to our Visual Studio. So what you have to do is to go and search for Python. And now the one that we need is Python by Microsoft. So click on that. So this is an official Python extension

16:37 by Microsoft. So let's go and download it. We're going to go over here and click on install. And with that, the extension is installed. This is really nice one in order to get smart suggestions, to highlight errors, to run things easier, and so on. And with that, we got our first extension in Visual Studio [music] Code. And now in the next step, I want you to go to the file over here in the menu. And then let's open a folder. And what you're going to do now is to create a folder where we're going to put all our Python codes. So make sure to put it somewhere safe. So we're going to go and create a new folder. Let's call it, for example, Python_arning. And select the folder. So now the window switch to the explorer, the first icon over here. And now we can see in this panel our folder [music] the python learning and here we can see all the folders and files that we are creating

17:24 in the projects. Great. Now we have the folder and now inside it we're going to create our first python file. So in order to do that we're going to go to this small icon over here and click on that. It's going to create a new file. Call it whatever you want. So let's call it hello. And now we have to tell our system this is not a normal file. This is a Python file. And for that we have to use the correct extension. PY stands for Python. So hit enter. And now our system understand. Aha this is a Python file. And as you can see we have here like nice small icon of Python. Now in the middle here you can see already our file is opened. And the editor is waiting for you to write something. And now we are ready to write our first Python code. And now don't worry about the syntax what we're going to write here because I will be explaining for you everything step by step. Don't worry about it. So just follow me now. We're

18:11 going to write print. This is a function that's going to print something in the output. And after that, we're going to go and open parenthesis here. As you can see, as you opened parenthesis, the editor closed it immediately because you need it at your code. So, we have opened and closed parenthesis. And now we go inside them and we type double quotes. So, as you can see, we have now two double quotes because this is the syntax in Python. So, as you can see, the editor here is helping us and adding stuff. So now in between of all those stuff we're going to write something like for example we can say hi this is my first Python [music] code something like this. So now we have our first code in Python and the next step is to go and execute it. So we're going to go to this play icon over here and click on it. And now my friends if you see in the terminal this message like this I can say congrats you have written your first

18:57 Python code. So now in the terminal you can see the output of your code. So the first few stuff is just like where your file is located. at what is very important is this message over here. This is the output of your code. We said in our code print this message and we got the message in the output. So with that we have told our PC to do something. We have written here like an instruction and our PC did understand what we want and executed the task and this is exactly what is programming. All right. So now what is next? We're going to talk about shortcuts. Now what you have done in order to run this code, we went to this icon over here and clicked on [music] it. And now my friends, we want to be professional, right? We don't want each time to go and click on the icon in order to execute our codes. We're going to go and use shortcuts. So now we're going to go to the command section. For Windows, hit shift control

19:46 and P. And if you are using Mac, shift, command P. And now we're going to go and search for the following preferences. And then double points. We need the open keyboard shortcuts. The one over here. So we can see now all the commands in the visual studio and the key binding the shortcuts. And now what do we want? We want to make a shortcut for running Python. So we're going to go and search for run Python file. So now we can see this command run Python file. And as a default, Visual Studio will not add any shortcut for it, but we're going to add it manually. So double click on the key binding. And now choose the shortcut that you want. I usually use the CtrlR. So that's it. Hit enter. So now you can see our nice shortcut and the source you see here it's user. Perfect. Now let's

20:31 go back to our code. You can see here in the tab hello.python and now we don't want to hit the play button. What we're going to do we will just going to use the shortcut. So ctrlr and perfect with that we have quickly executed our code like an expert. All right my friends. So with that we have prepared your PC with everything that we need in order to run and learn Python. Now, we're going to move to the bonus section to the luxury where we're going to add some decorations to our Visual Studio. It is not a must. It is nice to have. And this is the style that I like. So, let's go. Okay. So, now in order to add more decorations to our Visual Studio, we're going to go to the extensions. And the first thing that we can add is a theme for our Visual Studio. There are a lot of amazing themes for the coloring and stuff. So, I'm going to show you my top four themes and the one that I usually

21:19 follow. So one of the very famous one is called one dark pro. This one over here. This is very famous theme and you can go and install it and check whether you like it or not. And if you scroll down you can see more screenshots and informations about this theme. And you have to be careful on the marketplace. Some stuff are like free to use and others you have to pay like license. But for this one currently it is free. Another one that is very popular is the IO. So this one over here click on it. And this one as well very famous between developers. You can see there's like light mode, dark mode, and like different coloring. It's really here there's like no right and wrong. And this is as well for now it's free. And a third one that is very famous, Monokai Pro. This one sadly you have to pay for it. But this is as well really awesome. Like each time I try it, it feels really professional. But now we go to my

22:08 favorite one. It's going to be Dracula. So dra and this one over here. So click on that. You can try it and if you like it, you can use it like me. So we're going to go and install it. Trust and install. And now you can see immediately all the coloring of the Visual Studio did change. So now if you go back to our code, you can see the coloring did change. The print now is green. It is just clean, beautiful. I just like it. So try it out. It is free through the course. I will be using the theme but again it is not a must. Okay. So now moving on there is like one more thing that I like to add is different type of icons. You can see we have this small snake here for the python. But if you want to go and add some more fancy stuff

22:54 you can search for material icon theme. [music] The first one over here. So click on that. And if you scroll down you can see we will get like more colorful icons and stuff. Again this is only luxury. So I'm going to go and install it. Trust and install. So now if you go to the explorer over here you can see we have now nice colorful icon. It is just small stuff. Okay. So now let's go to the next one. This one going to be more serious not only colors and stuff. So now go and search for auto hip 8. So the first one here as well from Microsoft. So now this extension going to go and automatically format your code following the standard format and the styling guide of pip 8. Now what is exactly pip 8? It is a standard on how to format and style your Python codes using like a set of rules that you can follow in order to have clean, readable

23:41 and professional looking Python codes. So we can see here in the PIP 8 styling guide there are like a lot of rules that the developers should follow, right? And what this extension does is to go and format automatically your code using this standard style. So it is really nice. Go and [music] install it. And after that we can go back to our code over here. So now let's add some few bad styles to our code. So maybe few spaces before the parenthesis and after it and as well here. So this really doesn't look good. So now in order to format this we're going to go to the command section. So shift control P. So now we're going to search for format documents. This one over here. So click on it. And perfect. You can see it removed all those unneeded spaces. And with that we have automatically formatted our codes using standards. And

24:28 of course, you can go and create like shortcut in order to quickly format your code. So, my friends, those are the add-ons that we can add to our Visual Studio. And of course, if you installed something and you don't like it anymore, you can go back to your extensions. You can see we have here the installed section and you can go and uninstall your extension. So, my friend, that's all for now. We have prepared your setup in order to start learning Python. And now my friends to the last bonus. [music] I have prepared here the full Python road map using notion templates. You can go to the link in the description and you can download it. So this is really nice in order to track your progress. So for example you can see here the main phases of learning Python. We have beginner, intermediate and advanced and as well nice status how much you have already covered and then below that we have the course index.

25:16 Here we have everything. So we have the faces, the chapters and as well the lessons. Now we are currently at the introduction. So it is in progress. We already covered what is Python. So it's done. And as well we set up our environment. So we can go over here and say this is as well done. Now we can go to the next step and say this is in progress. And this is the first topic that we're going to cover in Python the comments. And as well you can go and add a plan when you will learn the next steps. So it's really nice way in order to organize your learning process. And now you can see here we have like many stuff like the board. So you can see immediately the chapters that are to be done, how much in progress and how much you have covered. It's called like a combo [music] board. And once you have planned everything, you can check the timeline, a calendar, and as well here we have a nice chart and how many topics that we have already covered. So it is a really great way in order to feel like

26:02 there is an achievement, there's like a progress. So if you'd like to plan and track your progress learning Python, you can go and use my notion templates. The first thing that we usually learn about any programming language is how to add comments to our code. So what [music] are comments? A comment is a line of text in your code that Python totally ignores. It is there only to help us in order to understand what the code is doing. Okay. So now let's understand how this exactly works. So now let's say that you are coding a script in Python and now you would like to add a comment. So now in order to do that we use the special character hash and after that whatever you want like for example start and then you say this is my code and then an end. So now once

26:49 you execute this what going to happen? Python going to say okay this is not a [music] code this is just for the humans and I'm going to go and totally ignore it so that means actually nothing happens it will not affect the logic inside your code or anything in the output it is just a comment for you so now if you say you know what why do we need comments now let's check [music] this on the left side we have a code that is actually working but it is kind of mystery right there is like some kind of filtering and we are multiplying stuff together but it's really hard to understand and to Now if you look to the right side we have the same code but this time we are adding comments in order to explain the steps. So first we are saying okay we are loading the data then we are filtering the data based on the month and the region and then we are

27:34 computing the revenue and at the end we are finding the total revenue and we are displaying it. So this is exactly the power of the comments. They're going to make your code understandable, readable, and professional. And believe me, you're going to thank yourself later once you come back to your code after a week or even a year or someone even from your team once they open your code, they will see these amazing comments in order to understand what is the logic of your code. So this is exactly why we add comments to our code. Okay. So now back to Visual Studio Code and let's go and add a comment. So we're going to start with a simple hash and then after that we can write whatever we want. So this is a comment and now if you go and execute it you can see in the output we are not getting anything because Python at the start sees okay we have this hash

28:21 symbol. So that means whatever comes after it it's for human. So nothing to execute and python can go and ignore it. And now of course this comment that we just created is a single line comment. So this is a single line but sometimes in our code we would like to add more description and we would like to have like multiple lines. And of course we can go and do that if you start always with the hash. So this is multi-line [music] comments. And now we can go and add more lines of comments. Like we say first create user name. Then maybe a second step we print message to user and a third step data. So as you can see we have now multi-line comments. This is really nice if you have like complex logic and you want to explain it like step by step. Okay. Okay. So now my

29:07 friend there are like different styles on how to place the comments inside your codes. So now let's say that in our code we have something like this X is equal to 10. Now if I would like to add a comment for this in order to explain it what we usually do is we go and place the comment on the top. So for example we say store the final exam score so that I understand okay I'm storing now the score 10 to the variable X. Don't worry about the syntax here. We're going to learn it in the next videos. So what we have done, we have placed a comment on top of our code that explains the next line of code. And now there is like another style where we add comments. Let me go over here and say x is equal to 9. Now instead of putting the comment on top of the codes, we will place the

29:53 comment at the end of the code. So we're going to say hash final exam score. So as you can see everything is in one line and we call this comment as inline comment. this type of comments it is really amazing in order to give a quick explanation and we usually keep it short as you can see I didn't say store the final exam score I just want to make it quick and short and say here final exam score so now if you go and execute this Python will not go and ignore the whole line because the line has two things first we have a code so Python going to go and execute this x is equal to 9 but the next part Python going to say okay we have here a hash symbol so that means Python going to go and ignore everything after [music] it, not the whole line. So again, if you want to make a long and

30:38 detailed explanations, place your comment above your code and you can go and add multiple lines and so on. But if you'd like to give short and quick explanation or a label, you can go and place your comment in the same line exactly at the end of your code. Okay, so now a quick recap. Comments are line of text that Python totally ignores. It is written only for us for humans and we add comments to our code in order to make it understandable, readable, professional and easy to maintain. It's going to help you and your team in the future to understand the thought process inside your code. So that's all about the comments. All right friends, so now we're going to talk about the very first command in Python and the most used piece of code that you will see everywhere in Python

31:25 projects. We are talking about the [music] print function. So what is print? Print is a built-in Python function that displays a text or a result in the output screen in order to communicate something to the users. So what this really means? So now let's say that you have a Python code and you are building like an application. Now in order to show a message in the output, we can use the function print. And the syntax for that is very simple. We use a function named print and then we put inside parentheses and double quotes a message like for example let's say hi. Now if you go and execute it what can happen? Python going to go and execute the function print where it's going to go and take whatever you written inside the message and move it and display it in the output and that's it. All what we are doing is we are sending a message

32:12 from our code to the output in order to communicate something to the users. And now of [music] course the question is what is function? Now we have like a dedicated complete chapter about the functions where we're going to deep dive into all details step by step. But now think about the function is like a mini machine in programming. You give it an input. It does some work and process your input behind the scenes and at the end it gives you back a result and output. So think of it, it's like a coffee machine. You give it the coffee beans and the water. Then the machine it does the work and at the output you will get your coffee. So you don't really care about all details how the coffee machine did make the coffee. It's enough for you to know what you want to give the machine and what you are expecting from the output. And this is exactly

32:59 what are functions in Python or in programming languages. And now you might ask where these functions come from. Well, we have three main sources for the functions. The first one is the built-in functions. They are functions that come with Python out of the box. You can just use them anytime you want inside your code. For example, we have the print function. That's why I said it is built-in function. And we have other functions like the input, the length function, max and so on. Now, the second source of functions, we have the third-party [music] functions. They come from external libraries like pandas, numpy, pispar, glotty and so on. Those libraries are developed from a third party from someone else. It's not from Python but still [clears throat] you can install them and use them in your code. And now the third source of functions we have the userdefined functions. These are the

33:47 ones that you my friend creates. So you can go and build your mini coffee machine. But now my friends we are focusing only on the built-in functions for now and we are learning those important functions that comes from Python like we are learning now the print function. Okay. So now back to Visual Studio and let's practice this function. Let's start with something basic. So we're going to use the function name print and then we're going to open parenthesis and close it. And now in between we have to go and give the message and we're going to do that using double quotes. And now we are ready to put our message. And you can write whatever you want. So for example, hi Python. And that's it. That's all. Let's go and execute it. Now you can see in the output we have as well the same message. Hi Python. So this is the most basic form of the print [music] statement. We are just telling Python

34:32 print this message to the user as it is. And now my friend there are like many special things that we can do inside [music] the print and I'm going to walk you now through them one by one. So the first thing is that we don't have to use always double quotes. We can go and use a single quotes and inside them we can go and write again any message. So if you go and execute it same thing going to happen. Python going to go and print the message. So you can use single or double quotes. Python going to accept them as long you are using the same type at the start and at the end. So for example, if I go and say over here print and let's say I start with double quotes and then I say hi and then I close it with single quotes. If I go and execute it, I will get a syntax error. So use the one that you like but always start and end with the same type. So this one is not working. I'm going to go and put it in a comment. Now my friends, you can

35:20 use the print in order to show anything in the output. And you can style and design the output as you want. So for example, if I go over here and say let's go and print for example like a lot of minuses and then in between I'm going to go and say print and few spaces learn Python and as well few spaces. It's like I'm making a title and at the end I will have as well few minuses. So now if I go and execute it I will get this cool design in the output. It's like a banner or a title or whatever. So you can go and have fun with the print in order to design anything in the output message. I just found this nice sketch in the internet of printing a dinosaur. So you can see you can use your imagination in order to draw something using [music] print in Python.

36:07 Okay. So now we're going to talk about special characters in Python. Now we have a lot of characters that has no special meaning in Python like regular letters A B Z and numbers 5 9 0 and as well a lot of symbols like at and question mark. They don't mean anything special and they are treated as normal text. But now in Python there are characters that have special meaning when you are writing text. They all start with backslash and once Python sees those characters it's going to understand immediately aha we have to do something extra. So they have special purpose. So now let's say that we have this text. So we have a sequence of characters numbers. This is for Python is totally normal and there's like no extra job to be done. But now if we put slash before the n then what we have done? We just broke the normal sequence

36:53 and now Python going to see special combination between the backslash and n and this has a special job where Python going to go and create a new line. So what we have done here is we have escaped a normal sequence and we have in Python different ways of escape [music] sequences like for example we have the backslash and the double quotes or a backslash with a single quotes. We use them in order to include those quotes in the text. And we have as well double backslashes in order to include a real backslash in the text. And then we have the backslash and n in order to create a new line in the output. And as well a backslash and t in order to add horizontal tab just to have like spaces between words. And as well we have the back slash and b for backspaces. All right. So now let's go back to our code in order to understand exactly what this

37:39 means. Now let's say that I would like to have in the output double quotes like for example I'm going to say over here hi Python but I'm going to go and put Python into double quotes because I would like to see that in the output. Now if you go and execute it you will get an error. So you can see Python saying okay in your file there is something wrong with your print. It is an invalid syntax. So let's go and check our code. You can see Python is now like in different color. It is not inside our message anymore because Python going to say okay this is the first message it start with the double quotes and ends with the double quote and then there is something called Python it will not understand what do you mean with that because it is not inside the message and then we have another message where it start and ends and inside it there is nothing so you cannot do that so now how we going to fix this we have to tell

38:28 Python in some way that this double quote is the content of the message it's not the end of the string is just part of the message and we can tell that for Python using the magic of the backslash. We can use it in order to escape a sequence. So now how we going to do it exactly before the double quotes the one that is part of the message we're going to type a backslash. So now we can see we are getting like different color and with that Python going to say okay there is something to skip here. The double quote that comes after the backslash it is not the end of the message. Now we are not done yet. We have as well this double quote after Python. This one should be as well skipped because it is part of the message. So we're going to add as well a backslash for it. And with that Python going to understand aha this is the content of the message. And the

39:15 last double quotes we don't have before it any backslash. Python going to understand okay this is the end of the message. So if you go and execute it you will see in the output we have hi Python and Python inside double quotes. So again by looking to this the first double quote is the start of the message. So, Python understand okay I have to print everything after it. Then the second double quotes we have before it a backslash. Python can understand I have to print it so it's not yet the end of the message. The third one is the same story. Python going to see before it there is a backslash. So it is as well the part of the message. And the fourth one we don't have a backslash before it. So it is the end of the message. This is exactly how Python going to read this print. [music] Now there is like another way in order to have double quotes in the output. you can go and use the other type with the

40:03 single quotes. So you say hi Python and you can put Python in double quotes. So if you go and execute it, it will work as well because you are using at the start and at the end single quotes and this will be working. And of course if you want to have like single quotes in the message, it will not work. So if I go over here and execute it, you will see we will get an error. So in order to have the single quote in the output you have to go and use as well the backslashes and if you go and execute it it will be working. So that means my friends you can use the backslash in order to skip a character to tell Python this is part of your message especially if you want to use the same type of code in the message in the output. Now the escape character the backslash can help us in many scenarios like for example let's say that I would like to go and

40:50 print the path of something. So I'm going to say path double point and we can say the path looks like this. The folder is C and then we have the folder users and then the folder of the user bar. Now if I go and execute it, you will see again I'm going to get an error. It says there is something wrong in the syntax. So what is going on over here? Backslashes are always a special character in Python. And each time you use them, Python going to think you are telling something. So for Python is not understanding what to do with this character B after the backslash. It's not command because Python going to expect from you using the backslash to do something like skipping special character or making a new line and so on. So now in order to tell Python this is actually the content of my message you have to have double backslashes. So

41:38 that we are telling Python, hey I want to have a real backslash in the output. I'm not using this one in order to skip any character and this is the only way in order to print a backslash in the output. The same thing over here. Now if you go and execute it and now Python going to say aha okay I understand you [music] you are just using the backslash to be printed in the output. You don't have any extra command for it. So in order to have a real backslash in the output you have to use double backslashes. As I told you there are a lot of special things about the print and the backslashes. Let's have the following scenario. I'm going to go over here and say message one and then I'm going to have another print message two. So now if you go and execute it, I will have those two messages in the output. Now if you say I would like to have like space or like divider a blank between those two messages in the output. Of

42:27 course you cannot go over here and add a blank between the two prints and execute it and then expect to have as well blank in the output. This of course will not work because in the line number two there is nothing to do for Python. So it will not go and print like a blank. Now there is like two ways in order to do that. Either you can go and say print and then you don't put anything inside this print. So there is no message it's [music] blank. If you go and execute it, you will have here like space between them. But there is like smarter way in order to have a blank or a new line in the output by using as well backslash. So how we can do it? We can go and get rid of this third [music] print. And now just at the end of the first message we can go and use backslash and then the character n. So now the combination of the backslash and n you are telling

43:14 python at the end of my message go and create a new line new empty line. So if you go and execute it you will get the same results. The first print going to go and print the first message. But at the end of this message we are telling Python to go and create an extra new line. And this is exactly why we have here a new line. This one came from the first print. And then after that we have the third line, the message two. This came from the second print because Python going to create a new line for each print. So this is exactly how it works. And if you say, you know what, I would like to have like three new lines. So all what you have to do is to put them after each other. So back slashn back slashn. If you go and execute it, you will get here three blanks, three new lines. So this is really nice. And now of course you can go and put

44:00 everything in one print. So I can take the message number two and put it exactly after the new three lines and then I can get rid of the second print [music] and execute it. So what is happening here? We have the message number one. This [music] is the first line. Then we have a new line that came from the first n. Then a second new line came from the [music] second back slashn. And then a third line came from the third backs slashn. But it's not empty because after it we have immediately a new message. So in the third line we have message number two. And now if you don't want to see any empty or blanks between those two messages, but you want to have everything in one print, you can go and get rid of two new lines and leave only one. So if you go and execute it, you are having two messages in the output, but each message has a new line. And that's because of this backslash n. So

44:48 these two prints going to give you exactly the same result as this one over here. So this is really amazing use case for the backslash. We can compact everything in one print and we start splitting the messages using backslash n. Okay. So now I have one more thing about the backslash for you. We can use it in order to add a tab space between the words. So let me show you for example if you go and remove this back slashn and go and execute it. Of course you can go over here and add like space in order to make separation between the words as well. You can go and use the backslash. So now in order to add a tab in [music] Python you can use back slash t. So now once Python sees this combination back slash anti it going to go and add a tab. So if you go and execute it you can see we have now a tab [music] between those two messages.

45:37 Okay. [music] So now I have a challenge for you. Now I want you to print in the output the following your learning path and then we have three bullet points. So Python basics, data engineering and AI. But very important those bullet points they do not start immediately as a new row. they have like a tab before them. It just looks nice, right? But now the real challenge here is to have only one print. Now pause the video and go and do that. Okay, so I hope that you have done it. Now we're going to do it together. So we're going to go and use print only once. I'm not allowed to use multiple prints and then double quotes. So let's start your learning path. Double points. And now we need the first bullet points. Python basics. But now if I go and execute it, I will have everything in one line. But I would like to have

46:25 Python basics as a new line. That's why I'm going to go exactly over here and make a backslash and n. So if I go and execute it, I will get it in one new line. But we are not there yet. I have to have like a tab. So exactly after the new line, we're going to have a tab. So back slash t. And if I go and execute it, I will get my tab as well. So perfect. I have my first point. Let's go to the second one. We're going to have as well minus data engineering. So if I go and execute it, everything going to be in one line back slash n back slashd and execute it. So with that I got a new point in a new line and as well I have a tab before it. Now we're going to go to the last one. So minus ai and if I execute it I will see it exactly after the engineering. I don't

47:10 want that. I want it in a new line and as well with the tab. So if I go and execute it, I will get the last point in the output. So as you can see the backslash gives me a lot of flexibility in order to put everything in one print and I can control exactly how to design the output of my message. Okay my friends now to the last technique. As you can see over here our message is not really nice like everything in one big line and you have to scroll left and right to see the whole message. Now if you have like a long message and you don't want to put everything in one big line, you can go and split your message into multiple lines and as well using only one print function. So now let me show you what I mean. Your learning path going to stay over here and then in order to see the rest I'm going to go and hit an enter in order to go a new line in my code. But as you can see things going to get red, right? But I'm

47:58 going to go and keep doing that. So for the second message a new line and for the third one a new line. Now, of course, if I go and execute it, you will get an error because Python will not allow it. Now, in order to fix this, we can use the triple quotes. So, now at the start, we're going to go and add triple quotes. And as well at the end, we will add triple quotes. Now, we can see in our code, we don't have anything red anymore. And if I go and execute it, you will see it is working. But we are getting as well extra new lines. So actually if you're using trouble quotes if you start a new message using a new line in your code it going to be considered as a new line. So that means we can go and get rid of the new lines. So we don't need those back slashes and n and if I go and execute it I will get the exact same results. So this is really nice way in order to add multiple lines in your code and as well multiple

48:49 lines in the output using one single print. You can do that only if you introduce three quotes. All right my friends. So with that I have covered let's say the most important tips and tricks that we can use inside the print. It is really fun in order to design an output [music] for your users. Now my [music] friend if you are total beginner in Python I know that you will have always the same question why do we need this stuff? How we going to use what we are learning in real projects? Let me show you real use cases in projects for the print function. So for example we have this code. You don't have to understand all details. But I want you to understand the use case of the function. So now we have here a lot of values and calculations and logics. Now if you run this code, you will not get anything in the outputs because

49:35 everything is happening behind the scenes and we don't have like a window to what is going on. And this is exactly when we need print. [music] Now in order to see more what is going on in our code and to see inside the box, what you're going to do, we're going to go and print the last results. So I'm going to go and say final total double points and then the final total. So if I go and execute it now you can understand aha the final total is this value. So we do it like this in the projects. In order to see the results we use a print. So we are sending the value from our code to the output. Now let's say that there is something wrong. I'm not really sure whether this value is correct. And in our code we have like many steps. And here again we use the function print in order to understand each substep. So for example I can go and place a print in

50:22 between here. And now this time we're going to say here subtotal is equal to as well subtotal. Now my friend don't worry about the syntax and what is going on here. I just want you to understand when we use print in real projects. So now if I go and execute it now I can see and understand aha the subtotal is this number and this might help me to understand the substeps inside my code and whether my calculations are correct. Now I can see the subtotal and maybe I want to see as well the discount. So I'm going to go over here as well and print as well this intermediate result the discount. So discount and as well execute. So now I see a lot of stuff the subtotal the discount and the final total and actually the calculation is correct. So my friends, this is a very important use case in real projects. We use it in

51:12 order to print the results of our calculations in the output that's going to make things more transparent for us and can help us in testing or debugging if there is something wrong in our calculations or logic. So this is how we use print in real world projects. Okay my friends, so now let's do a recap. Print is a built-in function in Python and we usually use it in order to communicate something to the users to show the progress and the steps of your logic in your code and as well we use it in order to debug and test. So the print function is very simple but yet very powerful and my friend I'm going to promise you something that you will end up using the print function [music] in every Python scripts from the day one in the beginner level until the very advanced levels in Python. you will end

52:00 up always using print. [music] So now we're going to talk about a fundamental and very important [music] concept in Python. We have the variables. So what is a variable? A variable is a name that you create to store value inside it in order to reuse it later in your program. So think about variables like a box and you give for this box a label like a name for it. It could be anything like a username, a country, an X. And we can put stuff inside this box. Anything you want like a number, a string, maybe a logic or calculations. So now once you have stuff inside this box, you can move this box everywhere in your code. And you can use this stuff wherever you want inside your code. And of course anytime you want,

52:45 you can go and open the box, take everything out from it, and put the new stuff inside it. And then again, you go and close the box and start using it around in your code. So this is what we mean with variables. [music] All right. So now as usual I'm going to show you a sketch in order to understand how Python execute variables behind the scenes. Okay. So now again we have our code and the output and we would like to go and create a variable. So we say the variable name is X and we want to store the number one inside it and we call this assignment. That means we are assigning the value one to the variable name X. So now once we execute it what's going to happen Python going to go and create let's say a box and call it variables. This box going to be storing like values and data in the memory that is ready to be used whenever we want. So

53:35 Python going to create in the memory variable called X and we'll assign for this variable the value one inside it. So so far what we have done we have created the variable we have assigned for it a value and now what is left is to use this variable. So let's say for example we use the function print. But now inside the parenthesis we will not use any value. We will use the variable name. So now if you go and execute it, Python cannot go and immediately print the value in the output. First Python has to go and get the value of the variable. So it's going to go and search in the memory for a variable called X. And once it finds it, it's going to go and return and reads its value in order to use it in the print. So now during the execution, instead of having X, we're going to have one. Now we have everything ready for the print. Python

54:21 going to go and print this message in the output. So you will see in the output one. So this is exactly how we work with the variables. We create one, we assign for it a value and then reuse it later. And now let's say that in the next steps in my code, we have to update the value of this variable. So we want to say forget about the one, go and store two instead. So it's very simple. In order to update the value, we're going to use the same syntax. So we're going to say x is equal to two. So now once you execute it Python going to go to the variables and see aha I have already an x. So python doesn't have to create a new one. All what's going to happen is that it going to go and update its value. Instead of one we're going to have to. So that means from this point x now is equal to [music] two inside the memory. And now for example if you go and print the x again the same thing going to happen. Python going to go and

55:09 search for the x but this time it's going to find two inside it and returns it to your code. And python going to print two instead of one. Okay. Okay. So now let's keep going. Now I would like to create a new variable called y. And now as usual we would like to assign for it a value. But this time we will not assign a direct value to it. We're going to assign for it like a calculation. So we're going to say the value of y going to be the result of x + 3. So now if you go and execute it, Python cannot go and immediately and create the variable y. First it has to do the calculation. And now in order to do the calculation, we need to find the value of x. So again, Python going to go and access the variables in order to find the variable x and then it going to read its value back to your code. So now we're going to get the two inside our code. And now

55:54 Python can do the calculation. So 2 + 3 the result going to be five. And now it has everything in order to create the variable. And Python going to go and create a new variable called y and assign for it the value five. And now if you check the variables box in our memory, we have two variables and each of them holding a value. And you can use them anytime you want in your program in order to do calculations, comparisons to display them anything you want. So for example, I can go and print the Y. So Python going to search for the variable Y and return its value and then print it in the output. So this is exactly how we work with the variables inside our code. And this is as well exactly how Python execute the variables behind the scenes. And of course, if you want in the future more content like this for free, then support the channel by subscribing,

…

Share

YouTube Video Summaries