Python BootCamp - A Step-By-Step Course To Master Python With Mini Projects | Dr. Chris Mall 30,000+ Students | Skillshare

Playback Speed


  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Python BootCamp - A Step-By-Step Course To Master Python With Mini Projects

teacher avatar Dr. Chris Mall 30,000+ Students, C# | Flutter | Scratch Instructor

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

15 Lessons (2h 48m)
    • 1. Welcome to Python Bootcamp and How It All Works

      2:31
    • 2. Let's Install Visual Studio Code

      10:04
    • 3. Configuring Visual Studio Code

      10:29
    • 4. Introduction to Python

      3:09
    • 5. Variables

      19:14
    • 6. How to utilize variables

      21:21
    • 7. Data Type Conversion

      6:11
    • 8. If-Statements and Conditional Logic in Python

      15:13
    • 9. Loops and Iteration in Python - Part 1

      6:39
    • 10. Loops and Iteration in Python - Part 2

      11:06
    • 11. Input/ Output and Files in Python

      11:28
    • 12. Function in Python

      14:41
    • 13. Sending Emails to multiple receivers with Python

      10:41
    • 14. XML parsing

      16:26
    • 15. Multithreading in Python

      8:24
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

4

Students

--

Projects

About This Class

Master Python like a Professional! Start from the basics and go all the way to creating your own applications and games! And remember Python sharpens your mind!

Meet Your Teacher

Teacher Profile Image

Dr. Chris Mall 30,000+ Students

C# | Flutter | Scratch Instructor

Teacher

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Welcome to Python Bootcamp and How It All Works: The programmers of tomorrow are the Wizards of the future. It's the closest, think you can get to have much power this 21st century, according to Gabe Newell, welcome to the three-step process to master Python for beginners, the course is designed to get you ready to learn Python with a complete masterclass from a to Zed. They will learn everything you need for Python with a three-step process and step-by-step examples. My name is Crystal and I will be leading you through this course. I call the piece the programming software in game development at I can guarantee that Python is a great language that you should learn. I designed this course for anyone who is interested in learning Python and wants to create impressive programs easily for his work or his personal portfolio. By the end of this course, you will be able to develop your own programs in Python. So why learn Python? Because with Python, you can automate things, read data from Excel, CSV, or text files, processes, and save new files. You will be able to connect databases, retrieve, and save new data, read the XML files, and process the data. Create impressive was resolved programs in a very short time, very, very easily. We're going to use a three-step process for developing new apps in Python. A three-step process that has to do with design, code and experience. So the big question remains, what does this masterclass include? It includes basic syntax variables, basic operators, decision-making, E-loops, elites, files, input and output functions, XML processing, sending emails, GUI programming, database access, and multithreading. So the ideal student of this course is anyone who is looking to improve his coding skills or students that they want to learn Python and make magic things happen. The ideal student of this course. So there are no requirements necessary to resolve the colonial, be asked to be open-minded and ready to learn. 2. Let's Install Visual Studio Code: Hey guys, welcome back. Now let's see how we can set up Visual Studio Code. So what is Visual Studio Code? Visual Studio Code is a source code editor developed by Microsoft for Windows, Linux, and Mac OS. So it's a source code editor. Or you could also hear it as a need the IDE, which means integrated development environment. So it's the same thing. Visual Studio Code is an environment where we can write our code. And it includes support for debugging, for good control, for syntax highlighting, and many, many more things. Actually. Thesis the main advantage of using Visual Studio Code. It's that we can have all these things in one environment. We can have support for debugging, for our code. We can have embedded deep controlled so that we can have versioned control of our program. And believe me, this is something very important when you write code, especially when you participate in large projects or your stand-alone program, could be a functional program in your organization, your company, or for yourself. It is important to have a version control system so that you know it's new feature that is added that applies in a specific version. The third one, very important feature is that it has syntax highlighting. So syntax highlighting. The fourth one has to do with intelligent code completion. This means that you have autocomplete. The next one has to do with snippets and code refactoring. And this is very important. Why? Because you will have some problems writing code. And you could use the auto code refactoring to check where it might be, the problem, the bag, and solve it very easily. Most of the times. Auto, solve it by the Visual Studio Code itself. And the final one, it is customizable. Customizable means that you can sense the editors theme. You can change keyboard shortcuts and preferences so that it will apply to yourself. It is important to say that visual Studio Code is based on electron. Electron is actually a framework which is used to deploy NodeJS applications for the desktop running on the blink layout engine. So although it uses the electron framework, the software does not use 80. 80 is another, actually another eat ID, another source code editor that could do a lot of things in the same way as Visual Studio Code. It's actually a competitor, an open source framework, an open source. But it's a comparator. So instead employs the same editor component. Code named Monaco. Visual Studio code employs the same enter component named Monaco that actually is used in Visual Studio Team Services, or as formerly called Visual Studio Online. So in the Stack Overflow, this year, 2018, according to developers Visual pseudo-code, who's ranked as the most popular developer environment tool. Actually, about 35 percent claimed that they use it. So is Visual Studio Code you actually, Visual Studio Code was announced on April 29th of 2015 by Microsoft. It was released under the MIT license on November 18th. 2015. And finally, on April 14th on 2016, Visual Studio Code graduated. The public preview States and finally released to the web. So what does this mean? What does this really mean? Can I write code and effect, can wheat programming languages? Can I use? Can I use in order to write, compile, and finally, run our programs? Actually, Visual Studio Code is a source code editor that supports a lot of programming languages and a set of features that may be available for a given number of languages. So you can write code with C and C plus plus, with CSRP, with HTML, CSS for web interfaces, PHP, Python. You can also write with our leg swings with SQL, with PowerShell, with Swift for iOS development, mobile development, TypeScript, XML, YAML, Visual Basic, JSON, javascript, Java, Go programming language, Docker, file, Ruby, and many more that I didn't write in this slide. Actually, as you can see, there are a lot of languages that are supported. They're accessed via the command palette or via JSON file for actually, you can define the user preferences that you want to use. The command palette is something like a command line interface. So all the disappears if the user clicks anywhere outside or presses a key combination on the keyboard to interact with something outside. This can also reappear and the command in progress is canceled. So what I would like to say is that Visual Studio Code features are not exposed all through main menus or through the user interface. You can use specific command line interface to cancel specific things that are happening in your code. So in the role of source code editor, Visual Studio Code allows tainting the code in which the active document is saved. And you can choose this feature in each programming language of the active document. So let's see that some more features Visual Studio Code can be extended via plugins. Actually, this is the most important feature in Visual Studio Code. We have a lot of plugins that data available through a central repository. And the next thing is that this includes additions to the editor and language support. So I will download and install Visual Studio Code. And if I want to write programs with Python, I will add like in Python in Visual Studio Code. If I would like to write programs in C or in CSR, I will activate the appropriate plugins for C and CSR. So let's start and install Visual Studio Code. We would like to open the explorer. You can use Google Chrome, Mozilla, Firefox, Internet Explorer, or reds, google Visual Studio code downloaded and setup and wallah, or smartphones here says, it's pronounced woah, not wallah. 3. Configuring Visual Studio Code: Now let's try to open Google Chrome, type there. Visual Studio Code and download Visual Studio Code. I have Windows 7, this machine, of course, you can also try for macOS, Debian, Ubuntu, Linux in general, whatever you might want. And I clicked in download, download started. If download is not starting, of course they can drive this direct download link. Here you can see all these things that I have already told you about intelligent code completion, about streamlined debugging. Very important feature, fast, powerful editing with autocomplete, linking, multi cursor editing, parameter hints and other powerful editing features. Of course, code navigation, entry factoring, very, very important so that you can browse your source code quickly using peak and navigate definition. And of course, in product source control with SEM support and get integration. So here you can see a lot of things here you can see also the most popular languages that are supported by Visual Studio code, python, Azure, Node.JS, JavaScript, and Power Cell C plus plus CSRP, T-SQL, GO Python. And of course, you can also see some useful instructions about how to start, how to make the first steps with Visual Studio code. After downloading the format, of course you can run it. I will choose English language. So I go again. Of course, inlays. As you can see here. Next, I accept that remained and you can set it up wherever you might want. Visual Studio Code. I will click here to add open with code action to Windows Explorer file contexts Menu. And also, we'll also click to the second option, open with code action to Windows Explorer directory contexts Menu. And I will click next and install. So it is a light code editor, so they will not take two mats to be installed in opposite with Visual Studio and Eclipse. So Lance, Visual Studio Code. And here you can see Visual Studio Code. The first thing that Visual Studio code does after the installation is actually try to find good. So in my computer, I have already installed. If you don't have good. Actually, it's really, it's really easy to also install Git. You will go to google.com. We will also type download git for Windows or for Linux or for Mac OS, whatever you might want. I will click here. I will download it. And then I will. And then you can of course installed. So I will try to create also a lesson for how you can use deet, because it is very important to know how to use good, especially if you're a developer in a project team. Or you are actually developing a big project and you should know how to. Develop each feature once in a time. So this is Visual Studio, visual Studio Code EDA. As I said, there are five tabs. As you can say, there is a shirts, a source control teabag, and the extensions. In the extensions, you can see that you can actually add whatever you might want, whichever language you might want. I will install Python right now. So I clicked, I typed Python. I will click here. The first one is seats. It's really easy to install its extension. Actually, it's, you can see how can be installed and what you can do as the first steps after installing Python. So Python is being installed right now. You can also choose other languages like C or C Sharp or whatever you might want and install them. And after installing, you will be able to actually compile the bag and run your program. So the first thing that you should know is how to install all the extensions, all the plugins that you might need. And the second thing is you will try to start a new project. And when starting a new project, you will see that you can define which language. It, it will be followed in order to be compiled and start demanding. So here I clicked in, started bagging. But the only environment that is already installed is NodeJS. When actually Python is feminist. I will also have Python right there available. I think you can try and see a lot of things right here. One thing that I would like to show you is that if I try to type something and I can save it here, you can see that you can actually click on the right extension. So if you want, for example, to create a Python program, I can type Hello program. And you can see that the extension of these files dot p-y, which means actually dot Python. So here it is, the output. There. There is not a git depository for the, in this folder that I saved Hello program file. But I can start dividing. And here you can see if I clicked right now in more so I can reload Python, show that Visual Studio code actually restarts. As you can see now that Python extension is installed, Visual Studio Code says that I have to also install these two things. So I just follow the instructions. And here it says that I should also download Python compiler manually. So that is what I do. After installing these languages. You will see right here that there is also, there is also Python environment available. So I think this is an intro for Visual Studio Code. We will use it and you will see many more things later while we are going to develop our own projects, our own examples. And you will be ready to use to use this code editor. And also other similar code editor like Atom or normal plus, plus. Thank you very much and looking forward to seeing you in the next lessons. 4. Introduction to Python: Hey guys, welcome back. Now let's start coding with Python and Visual Studio Code. I started with creating a new file. And I will save this file with Hello program to, because I have already created Hello program one. So I will name it kilo program two. I will put dot p-y so that it will, it will know that it's a Python file. Or you can just select the appropriate language right here. It actually dot p-y is disappeared. So when I save this file, you will see that I can start writing code. And here is the autocomplete from Visual Studio code. Actually, I will write print. Hello, Python. Hello, gold. So this is my first program. I would like Python to print Hello, Python, Hello World. This is the methods and I'm going right here. I can right-click and actually select Run Python file in terminal. So when you click right here, you will see that here in the bottom, in the terminal tab. Now that the debug console and the terminal Python is executed and your program is actually also executed. So this is my methods. Hello World. Hello students. I change my methods and again run Python file in terminal. And as you can see, the methods also is changed. So you will see that what I will do is actually invoking the interpreter with a script parameter. So that begins execution of the scripts and continues until the script is finished. So actually, we will go on and start by creating a little bit more complex programs. So this was the first program, the first hello world program will go on with next Programs. In the next lesson, we're looking forward to seeing your in them next. 5. Variables: Hey guys, welcome back. Now we will see variables and variable types in Python. So variables are nothing more but reserved memory locations to store values. So this means then that when we create a new variable, we actually reserve some space in memory. So Python variables do not need explicit declaration to reserve memory space. Declaration happens automatically when we assign a value to a variable. V equals sign is used to assign values to variables. So let's start and use the integer value variable. I will assign value 100. And I can write a comment with actually the SERP, the sharp symbol. I will write here that. And in the year variable is declared. So I will zoom it a little bit. So an integer valuable variable is declared. Very, very nice. And then I will write another one, a string variable with the methods shallow world. So this is a string variable. Excellent. Then I would like to print counter, and then I would like to print methods. So I will right-click right here, run Python file in terminal. And as you can see, it says that I have a syntax error missing parenthesis in coal to print. Did you mean print counter? Exactly. Print is actually a built-in function. And as you can see, when I click, I write print and I write the left parenthesis. Here, you can see that these built-in function needs a value. Actually, the value that will print, actually this value is, is something that should be in this built-in function while the other parameters could be omitted because this is underlined. So with param value, we print the values to the stream. And this is the optional keyword arguments. I could say if I would like to have a file, if I would like to have a space between values. The string appended after the last value will. By default, it's a new line, but it could be something else. And finally, the flux, whether to forcibly flux the stream. So for now, I will print only the counter, and in the next line, I will print only the message. So right now, I think it would be okay. Run Python file and terminal as, as you can see right here, my program printed these methods and then printed in a new line. As I said, by default is the new line at the end. So the counter and print methods. So 100 and helloworld right here. What were the values assigned to variable counter and two variable methods. So you can see the results right here. But also, what I really came is actually in Python, I can use multiple assignment. Python allows you to assign a single value to several variables simultaneously. What does this mean that I can use this one? A equals b equals c equals counter. And this means that I assign the value of the variable counter to the variables a, B, and C. So as you can see, I can then print right here, print a, and then in the next line, print B. So I could like right now, to pause the video and think what Will be the output after executing this program. What will my program print when I will execute it? Okay, let's see together, run Python file in terminal, right? I have this methods, Hello, Python, Hello, World, hello students. And then I have three print functions right here. The first one will print the value of the variable a that is 100. The second one, the value of the variable b, that is 100. And the final one, the value of the variable methods. Hello world. So actually here as you can see, an integer object is created with the value of the variable counter. And all three variables are assigned. All three variables, variable a, variable b, and variable c, are assigned to the same memory location. So we can also assign multiple objects to multiple variables. So I could say that I would like. On the other hand, I could say that I would like a b comma c to be assigned with counter plus methods. But this could be, will be, will be an error because methods is actually assigned right here. So I assign the value counter and the value of the variable methods to the variable a, b, c. So let's see. Watch will now be printed after executing our program, run Python file in terminal. And as you can see, okay, there is actually an error right here. Because what I would like to say is that they would like v three values to take three values right here at the same time. But here I have three variables. Here I have two variables. So I couldn't do something right here. But if I write counter comma counter common methods, then this means that the value of the variable counter will be assigned to the value of the variable a. The value of the variable counter will also be assigned to the variable b. And the value of the verbal message will be assigned to the value of the variable c. So I would like to print abc and then I would like to print the message. So please also pause the video and think what will be printed after this program is executed. So I will right-click right here. I will click Run Python file in terminal. And as you can see, print a, which means 100th, print B, which means the value of the variable counter, which means also 100. And then I will print c that has the value of the available methods, that is helloworld. And again, I will print the value of the variable methods. So you should also remember, remember that the data stored in memory can be of many types. For example, a man nsaids is stored as a numeric value and the address is stored as alphanumeric characters as a string. So Python, she has various standard data types that they are used to define the operations that are possible on them and the storage method for each of them. So Python, CS5, standard data types. The first one is numbers, data types of Python. The first one is numbers. The second one is string. The third one is list. The fourth one is tuple. And we will see what we mean with table. And the fifth one is dictionary, that we will also see in the next lessons. So actually, I would like to show you some examples right here. So I would say that I have var one and I will assign the value 2 thousand. So this is the first one. This is a number. It is important to know that number data types store numeric values. Number objects are creating when we assign a value to them. But we can also delete the reference to a number object by using the del statement. So I can use del VAR 1 and then we delete the reference to the number of objects VAR 1. So python supports for different numerical types. The first one, the first one is integer. The second one is float. That means floating point real values. The third one means that we have long. I will use parenthesis. Long means flow, long integers. And fourth one. The fourth one is complex, which means complex numbers. So these are the fourth numeric types. Actually. Python also allows, allows us to use strings. So strings in Python are identified as a contiguous set of characters that are represented in question marks. So we can use actually this one, this STR. How are you? This is STR variable, string variable. And then print STR as we did before. So how are you will be printed? But what I also can do is actually define what I would like to be printed so I can type, print STR, print parenthesis, I'm sorry, STR. And then use actually this parameter. And I will say that I would like to print only the first character. I would like to remind you that in arrays, the first element of an array is actually the element with the number 0. So what I really do here is actually convert this string variable to two, an array with characters. So I would like to print only the first character. And with this one, I print the first character of the string. While I can also do is actually print characters starting from the third to the fifth character of this string. So we print characters starting from the third to the fourth to the fifth, I'm sorry. And what I can also do is actually print concatenated strings. So I can print STTR plus hello people. So this one will print, how are you? Dot-dot-dot Hello people. So if I try now to execute, and I would like to show you something more, I can also print SDR dot four, I'm sorry, multipath multiplied by four. Which means that I would like to print string five times. While this one means that I would like to print concatenated strings. So now I will try to execute. I will right-click write Python, file and terminal. Oh, yes, I have a syntax error in line 29, so I'm going to line 29. And here, of course, it should be inside. Yes, right there. So run Python file and terminal again. And as you can see here, I have my messages. How are you? It's printed. Here. I have only the first character of the string. Here I have the string, the third to the fifth character, that is W. And here, I don't have, I'm sure to the third, to the fourth character, if I would like. Also, we have the fifth and the sixth seventh. I will write here seven, and I will try to run it again. As you can see, I have W, the space that is also a character. These three characters right here, so forth to the seven character. And here I would like to preprinted concatenated strings. How are you? Hello people. And here I have to print this string five times 1234, I'm sorry, four times. I save multiplied by four. So four times. And all this produces this result. So favour months. And looking forward to seeing you in the next lesson that we will see lists, tuples, and dictionaries. 6. How to utilize variables: Hey guys, welcome back. Now we're going to see what our Python tuples, what are lists, and actually what our Python dictionaries. So let's start by, let's start with Python lists. Lists are the most versatile of Python's compound data types. A list contains items separated by commas and enclosed with square brackets. It's the same with arrays. It's the same thing that we have seen before in our eyes. So to some extent, lists are similar to arrays in C, C plus, plus, and Java. The only difference between them is that all of the items belonging to a list can be of different data type. In arrays. All the items that belongs to an array should be two of the same data type. While in lists, in Python lists, all the items belonging to a list can be of different datatype. The values stored in a list can be assessed using the slice operator and with indexes starting at 0, the beginning of the list. So let's see an example. I will create a list with the first one, or b, helloworld value, a string value. The second one will be one hundred and one hundred and fifty. The third one will be 1.25. The fourth one will be, my name is Christos string, and the final one will be 100, 25. So as you see right here, I have a string, I have an integer, I have a float. I have a string again, and I have another one float. So then I will go and I will create a second tiny list that has only two values. The first one would be 300 and the second one will be Christos. So I have two values and then I will print list. And I will print timey least multiplied by two. But one common mistake that I always do is that I forgot to print to enclose the parameter in parenthesis. Actually, I forget to enclose the attribute in parenthesis because in the previous versions of Python, this was not something that it was necessary. So this is actually in the new versions and the new versions of Python combiners. So now I will see what it will be printed. But actually because I have all these printed before the lists, I will create a print variable right here, and I will right, lists, something like that. So I will actually right-click and run Python file in terminal. So let's see what we created right there. Who? Nice show here. There is a list. Here. We have actually printed the complete list. Here. We print the complete list. And here we print the tiny list. Two times. I can also print the first element of this list. While Eigen also print as I did in the characters before, as you can see right here in the string. I can also print only the second and the third one. So I can tell from the first. The third, this means the second till third. I will print of the list. I can also print list plus tiny list. So let's see what will be the outcome. So this, these commands will produce the following result. So I will right-click and run Python file in terminal. Let's see the result. Right here. Leads. I started the print of lists actually. So I have the complete list being printed. Then I have the talent lists, two times 300 and crystals recovering crystals. Then I have only the first element of the list. And you can see that actually it's only the value of the first element being printed. While here, because I have two values, I have actually a sublist is being printed as one hundred and fifty and one hundred and twenty five. Finally, I have the list plus panelists. So I have all these plus 300 and crystals being printed. So as you can see, this is a good example to understand how I can use lists. How we can use actually arrays in Python. And it's something really valuable. So I will create here a comment. I will write lists, and here I will write string. So we will go next and we will see what are tuples. So I will write right here cables and see some examples right there. Actually, a tuple is another sequence data type that is very similar to the lists. A tuple consists of a number of values separated by commas. But unlike lists, tuples are enclosed within parenthesis. So the main differences between lists Tuples are that lists are enclosed in brackets and their elements and size can be changed while tuples are enclosed in parenthesis and cannot be updated. So tuples can be thought as something like a read only lists. So a tuple is a read-only lists. So let's see some examples. I will create a sample. Right here. I will name it sample tuple. And I will create my name. I will create an Hello World. Again. I would like my name hello priestess. Then I will create a number, 185, then 3.14. Then I will create something like Hi again. And then 150, 23. So again, I can create a tiny sample tuple right there, and I will write 450. And John. So I'll write my name here, crystals. So I can take all this copy of the code, paste it, and I will change this to tuples. I will change all the list right there. I will copy it and I will paste it right here, as you can say. And I will also take tiny sample tuples and I will replace tiny list. Okay? So I have the same example, but with tuples and timing tuples right here. So these commands produce the result that we will see right there. So I will right-click and I will click Run Python file in terminal. So as you can see, we have exactly. The same results. So I have sample tuple right here. Hello, priestess 485, all these values. Then I print same tiny sample tuple two times. Then I have from single tuple, the first value. I have the second and the third guy right here. And finally we have sampled tuple and tiny assembled pupil at the same time. So if I try to Saints something in this tuple, I will save an error. So if I'm trying to say something like tuple, the second value of trouble to be 500. And as you will see, I will have an error. While this is not, this is not a problem for a list because I said that tuple is a read-only list. While. And as you can see here, I have typer, type does not support item assignment. While here, I don't have and a problem. As you can see, everything is executed, right? And if I do it here, if I write here before the print, we will see that instead of 1, 25, I will have the value 500. So let's see. And exactly before here are tuples, but if I go right up, I have 500. So the value, the third value, actually sth and 500, is being printed. So Very nice. Let's go on and see what our Python's dictionaries. So actually Python's dictionaries are kind of table type. Actually, they work like associative arrays or gases if you know, parallel programming language and consist of specific key value pairs. So a dictionary key can be almost any Python type, but usually are either numbers or strings. So values, on the other hand, can be any Python object. So dictionaries are enclosed by curly braces and values can be assigned and assessed using square braces. So let's see an example. I will create first dictionary light here, dictionary, and I will assign nothing. So then I assigned dictionaries and I will assign T1. This is the first element. While then I will use dictionaries to. But be careful here I have a string, here I have an integer. So this is the second element. And I will also create a dictionary that I will use a pair of t values. Key-value pairs show, I will say that ICF, My name is Christos. My aids is 33. And my ID I'm sorry. My ID is 23456. And my job is I'm sorry. Instructor. So as you can see, I can print dictionary. I will copy paste actually dictionaries. There is a mistake, our dictionaries dictionary. And here again, dictionary. So I will like to print dictionary one. So you can easily understand that here. I will print the value of T one. While I can also print dictionary to copy and paste it. And then I can print tiny. I will copy and paste it. Dictionary. Here I will print the whole, like. Print complete tiny dictionary. While here I will print the value of the key to, right. So there are some built-in functions that I can use right here, which means that I can use that I would like to print time and Dictionary dot k. And here you can see what I can really use. After the dot, I would like to use the keys so that I will like to print all the keys. I can also print. Print with the tub. You can create. You can complete the autocomplete suggested here. So I hit tab, so print tiny dictionary dot v, I'm sorry, dot v, n tab. So dark values. But the keys and values are functions show they need parenthesis. As you can see, the default values need parenthesis. And I will print all the values. So what I forgot to do is here to use a print, copy it right here. And instead of tuples, I will also copy right here. So that I will say that I want to print dictionaries. So let's see what do we did. Right-click right here. Run Python file in terminal. And let's see, in Hubble's write ups where you have here, print dictionary. Okay? When I forgot, was actually two, use all the parentheses right here again, the same mistake as I said in the previous versions of Python. It was not necessary. So I always forget to use these parenthesis. But it's normal because print is actually one of the basic built-in functions in most languages. So again run Python, file and terminal. And here we have all the values from dictionary. This is the first element, this is the second element. As we assigned here, a key and a value. So we would like to print the value of the key one. This is the first element, is the second element exactly. Then we would like to bring the complete timey dictionary. So we have all the tiny dictionary here. Exactly in venues like only the keys, overtime dictionary. And here we have name, aids, ID, and job. Well here we have all the values. So as you can see, the values are crystals 33, this ID, and the instructor. So you can see that the above code produce this result. So I think you show an example of its data type. And we will see some more things in the next lesson about how we can convert types. How can achieve data type conversion. So looking forward to seeing you in the next lesson. 7. Data Type Conversion: Hey guys, welcome back. Now let's see some things about data type conversion. So actually, sometimes you might need to perform conversions between the building type. So it is important to know how to use the type names as a function. So there are several built-in functions to perform conversion from one data type to another. And this is actually in not only Python, but in most of the languages that are used. Like Java. Flatter, Dart, C, C plus plus is sharp in its language. You can use a function to convert to an integer or string representation to anything you might want. So some very basic functions that you can use in order to convert something to an integer is actually you can use the built-in function int. We are where you can actually, as you can see right here, convert a number or string to an integer or a 1000 if no arguments are given, if x is a number, returning x, etc. So I replied to actually transform 20 to an integer. And I would like to print actually this. So as you can see, I will right-click run Python file, and here it is 20. But what you can really do here is print something like this. And it will print 30, because this is a string, but it's converted to an integer, and then it's trendy plus 10. You can at the same time use long so that you can convert this one, this string, to a long integer. And you can also print this. Okay? Okay. So long is not used in this version, but it's something that you can really type into Google and find the right, the right built-in function that you can use to convert something to an integer or to a floating point number like this. I can use For int float, and then converts a number or a string to an integer, et cetera. So I will write 10.34. So if I would like to print it exactly plus 23.1. So you can see that it's 333.5 right here. That is 10.4 plus 23 plus R1. Again, you can use the built-in function SDR that you convert something to a string. Or you can use complex where you can convert a number or string to an integer, et cetera. But I repeat that emits language. There are a lot of built-in functions and you can really use the Google to find the right one whenever you would like to transform. To convert a string to an integer over an integer to a float point. You can also use least to convert a string to a list or something else to a list. You can use dict so that you can create a new empty dictionary or a new dictionary initialized from a mapping object purse, or in your dictionary initialized as it via, as you can see right here. You can use the C8 R, which means that it gets a parameter, ie, an integer. And the return returns a Unicode string of one character with ordinal. So you can actually convert string to unicode. A lot of others. If you would like something more specific, like to convert the single character to an integer or to hexa decimal shrink. But this is of course, something that are specific to things that you would like to do. So I think that's that. Now have an overview about variables in Python. And we can go on and see some more specific things. So I'm looking forward to seeing you in the next lessons. 8. If-Statements and Conditional Logic in Python: Hey guys, welcome back. Now we will see how we can achieve decision-making in Python, which means how we can have if expressions, multiple if expressions nested IF expressions. So let's start with the single if expressions and how we can have if statements in Python. So an if statement consists of a Boolean expression which is followed by one or more statements. So Eigen have single IF statements right here. And this means that I can share an example like var one is 5000. If, I'm sorry, If parenthesis var one is equal, you can have empty spaces right here or not. Doesn't affect anything. Is equal to 1, 0, 0, 0, 0, 0, 0. Then, then is in Python actually this symbol. So it's actually one line IF, and then we can say that I would like to print the value of the variable is 1, 0, 0, 0, 0, 0. So the value of a variable is 5000. So I think that the CIF will not execute it because this is actually a false statement. 5000 is not equal with one hundred, ten hundred. I will also print here, right? If statement. So what I would like to be distinct and run Python and terminals. As you can see, I have only v sprint if statements and this is omitted. This is not executed, but if I'm going to change this to 5000, then I will also have the sprint. So right-click and run Python file in terminal. And as you can see, this if statement is executed. So be careful. Because something that is really important in Python is that this print, this print command is actually nested, as you can see, it's not right here, but we have a tub. It's our inside from the if statement. And this means that if this if statement is true, then I would like to execute this command. So I can have a second command and many more commands above. This is the second command. And as you can see, if this if statement is true, then these two commands will be executed. But if this is false, then these two commands will be omitted and not executed. As you can see if statements nothing printed. But if I'm going to write this one, this means that if this is true, then this will be executed. While this is not inside, the if statement is something that will be executed, either if this is true or this is false. So if I'm going, I'm sorry to leave. The space is right here to have a tab right here. This means that it will be executed as the above print command only if this is true. While this means that this will be executed. This is after the if statement, so it will be executed otherwise. So I'm going to run Python file in terminal. And as you can see, although this is not true, this is executed. This is not executed. This print, the value of the variable is 100, but this is actually executed. So this is something very important to remember in Python when you execute single statements or nested statements or if else statement. So now let's go on and see another example with Where we can have an if else statement. So we can say that if the value of the variable is 5000, 3000, then to execute this command, else. And this is, as you can see, it's nested. So this will actually produce an error, as you can see, because cannot be inside the if statement, inside this commands. This is something that it is in the if statements, so it should be right here. And this, now, I would like to be executed only if VR1 is not true. So now I will have this one printed. Exactly. This is the second command. And if I'm going to change this to 5000, which will produce a true result, then the second the second command will be omitted. And again, if I'm going actually to have something like this, this means that if the else statement is executed, then there are no commands right there. This will be executed in any way. So as you can see, yeah, exactly. I could not have some aggregates because there should be some commands or it shouldn't be anything here. So this is the else if statement. So I would like to have also this. I will copy it and I go paste it. I will change this. If else statements, I will delete this so that you can have this example as a note. So if I'm going and I go right, right here, if else statements. So let's try to run Python file and terminal. If else statements. Here we have is 5000 and 5000. So let's see one final example with if else statements. So we can have if and else statements, but we can also have if elseif else statements. So this command is actually the if command in Python. So we can have something like I will copy it again. I will paste it. If elif else statements, which means that we can say here, if V1 is equal with 3000, then print the value of the variable is 3000. I will copy it and I will paste it below. Be careful with the space is right here with the blanks. I will say that if var is equal with 4000 to be as 4 thousand elif. And finally, I will say that if is equal with 5000 to print this variable right here. The value of the variable is not 3000, 4000, or 5000. So actually the valid variable right now is 5000. So it will execute this command only if the var, the value of the variable would be 3000. And because it's not 3000, it will omit this command. It will then compare the value of variable one with 4000. Again, it's not true, so it will omit it. And then this, actually, this comparison produces a true statement, which means that it will execute this command and then it will omit totally this block right here. So I can right-click run Python. Okay, I will also change this one because it's not true if elif else. Statements. And I will right-click run Python file in terminal. And as you can see, I have only this print right here. So you can have many commands in its block that will be executed if something is true. So as you can see, but be careful with the blank spaces right here. Exact. So I will change it to false to 3000. And as you can see, after this comparison produces a true result, it will omit totally. It will meet all the other else-if and else comparisons. So it's x, its condition. And after a condition resolves to true, then these commands are executed. So let's try to execute rack, right-click python file in terminal. And as you can see, the value of the variable is 3000. So I think with these three examples, you can have a good overview about the EAF, we, elseif and the if else commands. Don't forget that you can combine these statements and have nested if statements, which means that you can say var one is 3000. If VAR 1 is 3000, then I would like to have var2 with 4000. And then to say that if var 2 is equal, I'm sorry for this is equal with 4000, then print. Be careful with the tabs. I have two tabs right here, so that will be inside from the if statement. Print. Var two is 4 thousand. So var two is 4 thousand will be executed only if this is true. And of course, if this is true. So I will execute the right now. How and as you can see, there were there was an arrow because I forgot this one and this one. And right now I execute again. And as you can see, it says that var2 is 4 thousand, but is going to change this. And also chains this. Else. Again. Print var 2 is not, is not for 1000. So I will right-click run Python file in terminal, and this time only this one is executed. If I'm going to change this one to a 100 thousand, less than this means that this will, these commands will not execute it because this statement is false. So I right-click. And as you can see, nothing is printed after this last command. So I think that this was a good example, a good overview of the if statements, the nested if statements, the if elif else statement, and the if else statements. So I'm looking forward to seeing you in the next lesson. 9. Loops and Iteration in Python - Part 1: Hey guys, welcome back. Now we will see loops. A loop statement allows us to execute a statement of or groups of statements multiple times. So actually can have while loops that we repeat a statement or a group of statements while a given condition is true. We can also have FOR loop that this means that we can execute a sequence of statements multiple times. And actually it abbreviates the code that manages the loop variable. And we can finally have nested loops where we can have one or more loop or are more loops inside one to another. So we can have while, for do while loop. So let's see some examples. So for example, the first thing we have to do is to write here a comment and say that we're going to have some loop statements right here. So the first one, the first loop, is the first loop, the while loop, first loop example. So here we can say that we will use an integer variable called I. And I will say, while I is less than than five, then print, but be careful here is inside from the while. So I will, I typed a tab right here. And I will say the value of I is, I will use a comma after the brackets and then I will type I. Which means that this text will be static, will be repeated five times, because I'll say that while I is less than five, the initial value is 0. So 0 is less than five and it will be printed. The value of I is, and the value of I is 0, then we will go up and the value would also be 0. So this is actually a loop that will be executed forever. So I have to increment value of the variable I. So I'm going to say that the new value, the new value of the variable I, will be I plus 1. So it would be the initial value will be 0, but the next value will be 0 plus one is one. So the new value of I is one. So one is less than five, it will be printed. The value of I is an empty space here, and then 11 plus one makes two. So the new value of the variable i will be two, it will go up. Two is less than five. So again, there will be 34 until I will be five, is not less than five, it's equal five. So then it will stop executing these commands and we'll go to the end. So I will print here and of program. So let's see. And I will also copy this command. I will paste it right here. And I go right while loop. So right-click, run Python file in terminal, entire human error. I have an error because as to the if statements here, we need this symbol. That is actually, it actually used to say that here is where we start the commands, executing the commands. So I will right click Run Python, file and terminal. And as you can see exactly here, it starts the while loop. The value of I, the value of I is 1, 2, 3, 4, and 5 is not printed because five is not less than five. So the block here, consisting of the print and increments statement is executed repeatedly until the I variable is no longer less than five. So with each iteration, the current value of the index I is the displayed, then is increased by one. Actually, if I'm going to delete this command, as I said, we will have infinite loop. And this is one of the most basic errors made in computer programming encoding. So if I'm going to run right here, I go save over time. The value of the eye is 000 and never ends. 10. Loops and Iteration in Python - Part 2: So in order to stop the terminal, you can just kill terminal right here. And then right-click. And again run Python file in terminal. So I will kill it again. And I will bring back this command to increment the value of variable i. Then I will right-click run Python file in terminal. If it does, you can see it's now okay. So an infinite loop might only be useful in programming. We would like to have something to run continuously so that the client programs, for example, can communicate with it as and when required. So I could also have an else statement in Python. And there's not a lot of languages that support this feature, but Python supports to have an else statement associated with a loop statement. So if we all statement is used, for example, for a while loop, the else statement is executed when the condition becomes false. So if the I is not less than five, then I can print that the value of I is, I'm sorry, more than five. It is. And so if I'm going to executed, it will produce the following result. Is equal. Actually, it's right, or more and five. It is five, but this else will execute, will be executed only once. So that I can have an infinite loop just by using the else. Because if I check, if something is not true, it would be always false. So this is the example of the first loop example, the while example. We will see now how we can use the second loop example. That it is the four loop example. So this means that we have the ability to iterate over the items of any sequence, such as, for example, a list or a string. So I can use, for example, a list right here with names. And I will have Christos, my name, Maria and John. And then I can say for name, I will use a variable name, a variable with the name name. And I will also use the names list above. So Eigen say for name, for each name that is in the names list, I would like to print current name and the name print and program. So now if I'm going to execute it, I will see that its name is being printed. And then I save the end of the program right here. So it produces the result. But I can also actually use the one other example. I can use the I variable. So I can also have this example. Third loop example. With loop. I can also use this example. I'm right here FOR loop. But I will say for for I in range, which reigns from 0 to five. I would like to print these values. And I can also use the else statement with a for loop. If the understatement is used with a for loop, the else statement is executed when the loop says exhausted, I iterating through the list. So now I go again, run it. So for I in range 0 to five, again, I have to type this symbol right here, right-click. And as you can see with this for-loop, I have exactly the same example. The same print, print, the same statements being printed right here. And actually, what am I, what am saying to Python is use an i variable with initial value of a variable to be 0. And then as the value is less than five, it's inside this rains. Then print the value of I is this one. So this is an example of iterating a sequence list. We can also have nested loops. So an example would be a fourth nested while example loop would be to have something. I will copy this print nested while loop. And then I is 0. I will actually use the first example. And I'm going to say exactly the same things while I is 0 than five. But here I go use another value and another variable. And I will say that j is equal to and while they is less than I. Then print. I would like also to print the the j value is, and I'm sorry, and here the comma, commas here is j. And then they equals j plus one. So this means exactly the same guy that it emits iteration, we will increase j by one. So right-click run Python, file and terminal. We have a problem right here. We have an invalid syntax because I have to use again this symbol that I always forget. And as you can see, the I value, the value of variable I is 0, is 1, is 2, while is two. J is not less than I, but when I is three, then I have printed the z value. And again, when it's four, I have always being printed. So if I'm going to say here, for example, say equals 0. Again. You will see and run Python file in terminal that the z value begins with 0, then one is not more than 0. So it's time. I have, I have printed the values of j that when it reaches the value of the variable i, then it goes out from this loop. And then the value of the variable I is incremented. And the J is from 0 to three, for example, until the value of the variable I is four. Well, and then I have the final print, the else print and vent of program. So I think these examples, you have an overview of how we can use this this loop examples. So I'm looking forward to seeing you in the next lesson. 11. Input/ Output and Files in Python: Hey guys, Welcome back. Now in this lesson, we will see all the basic input, output functions that are available in Python and these functions in glued files input, output. So let's see the first command that is actually the print command. Print command is the simplest way to produce output using the print built-in function, where we pass the string that we would like to be present in scream. So these examples that we saw in the previous lessons produced all of these outputs in the terminal in our screen. So we can also use reading keyboard input. So python provides also a built-in function to read a line of text from keyboard, from standard input with, by default comes from the keyboard. So let's try to use the built-in input function. So the built-in input function reads one line from standard input and returns as a string. So let's try to create here an STR input. Enter something here with your keyboard. Okay, I will chains enter to type something here with your keyboard, and then print you typed STR. So let's try to right-click run Python, file and terminal. And as you can see, here, is the message type something here with your keyboard. And then if I type here, Hello, my name is Christos. You will see that you typed hello. My name is Crystal. I could also maybe use this one so it is more clear. Oh, sorry, magnesium. Here, hello, you typed hello. So this is a good example that you can see the input function that is used to read one line, one line, one line from standard input and return it as a string. I could also use opening and closing files. So I can use the built-in open function so that It's actually a basic function that includes all the basic methods necessary to manipulate files by default. So until now, we have been reading and writing the standard input and standard output keyboard and screen. And now we will use the open function to use files. So actually, in order to use files, I can use the built-in function open. So I will write f equals open, my file dot TXT. And I will say that I want to use this file for writing purposes. So I will use the attributes w. So I would like to use some built-in functions that I will show you right here. For example, print in the screen name of file is. And then I can use the built-in function f dot, name, print, PTs. I'm sorry, share memory space, F dot. And here you can see all the built-in functions that you can read what it actually is doing and use it or not. So one built-in function is the f dot closed. That means that it will return. If it is. Closed or not. So it will return a true or false file. And then I would like to use it. Again. It is open or closed. So I will use the F0 dot mode in order to see the opening mode. So this is a good example that I would like to run, run Python file in terminal, okay, I have nine. As you can see, the name of the file is my file.txt. So took the attribute name and it printed mine screen. It is not closed, so it is open. It is by default open as I have opened it right here. And the mode is W is not R, it's for writing. So I can actually then close the file by using the f, sorry, f dot close. And then the file is closed now in order to open it and read it from from my computer. So I will use, now, I will use the write method so that I will write something in my file. So I will tell my computer that I would like to save the file, create and save the file, my file.txt in the C directory, in the main directory. I use Windows. If you're using Linux or Mac, you can specify the directory that you would like to save this file. And I go right inside my file, f dot, right? Hello, beautiful world. So I will run it right-click, run Python phylum terminale, type something here with your keyboards. Again, this example above, so 10 times 10. Okay? So if I'm going to the C file and open my file.txt, you will see that Hello, beautiful world is printed inside my file. So as you actually saw there, I can very easily write something to my file. So again, instead of writing, I can also use reading. So I can use STR equals f dot read. And I can specify how many characters I would like to read. So I will type 10 and then print STR in the screen. So let's try to use it. Run Python file in terminal. Again, this example. Okay, As you can see, it says that you have an error here. The input file is not readable. And that's very correct because I said that I will use this file for writing purposes. So I will take this, I will get this, and I will paste it below. I will take this line. I will copy it. I will paste it. But I will change the mode to reading mode. And then I will close again the file. But I will also take this print because I want it right there. So this is the example. Right-click run Python file intrapreneurial. This is example again. And as you can see, it took, and it printed the first 10 characters from the string. So with the read, with the built-in read method, we read a string from an open file. It is important to note that Python strings can have also binary data apart from text data. So what we did is we passed the parameter, the number of bytes to be read from the open file. And this method starts reading from the beginning of the file. And if count is missing, then tries to read as much as possible may be until the end of file. So if I'm going to delete this, it will read everything that is in this file. And as you can see, everything is stored in this string and it is printed. So reading data from file, reading data, writing data to file, these are two examples. Reading data from keyboards right here. So these are the examples that you can use for a complete input, output. Experience. 12. Function in Python: Hey guys, Welcome back. Now in this lesson, we will see the functions in Python. And a function is a block of organized reusable code that is used to perform a single batch specific function. So functions provide better modularity for our applications. And this allows us to use a high degree of code reusing. So as you already know, Python gives us a lot of built-in functions. For example, print, as we saw in the previous examples. So these functions are called User defined functions that we will see today. So we can create our own functions. The way is very, very simple. First of all, we define in the start of our program, we're going to define our function so that we can use it later in our program. So I will write the keyword def. That means that I would like to define a new function. A function block begins with the keyword def, followed by the function name. So I will name this function as first function used. You can use any name that you would like to use. And then I will give my parameters. So for example, I will save that. I will read the string. I will read the string. And then I will tell that this function will print hello plus the string provided. So this is actually the documentation of this function that tells us what this function actually will do after it could be executed. So then I'm going to use, to use the command that will be executed each time this function is called. So I will tell print, I'm sorry, print hello plus STR. I will also leave an empty space back here. Print hello, Let's they are return. So now I'm going to the end of my program and I'm going to call this function. Actually, I will tell you this is a comment we'll call. The first function is used to print a string. So I will use the name of my function. Hello. I will write Wald. And then I will use the same function to write to all of you. So it's time that I would like to have hello plus the string. I will use the first function used name. I can also change the name to something easier, like hello. So I will also change this name to hello. And then I will change it here to my comments to hello. So I will right-click run Python file in terminal. Okay, I have, here, I have again the same error that is used to do in the previous lessons. Now this, okay, as you can see. So I will right-click and run Python file in terminal. This is from one of my previous examples. As you can see. Here, I have hello world, hello to all of you, to the phrase hello beautiful world is from this example. So the two last sentences are from my function. So as you already algae have already seen, defining a function only gives it a name, specifies the parameters that are to be including the function and structures, the blocks of code. Once the basic structure of a function is finalized, you can execute it by calling it from another function. Directly from the Python prompt. So following this example, you can call this hello function and print whatever you might want with the hello phrase. So as you can see, we can also use functions and pass by reference specific value. So all parameters in the Python language are passed by reference. This means that if you would like to change what a parameter refers to within a function, these chains all show reflects back in the following functions. So we will use another function. I will go again in the beginning. I will use def, saying it, I'm sorry, change IT. Function with a list right here. And we will taint the past list into this function. So I will write my list dot append. And I will add 1, 5, 10, 15. And then I will print value inside, then function. And I will print my list and then return. So I will call the function. I will write right here, my list two, then 2013, right here, 10, 20, 30. And then I will, I'm sorry for this, 10, 20, 30. And then I will write, change it. Mylist. And I will print values outside are now my list. So as you can see right now, as you can see right now, the new values of the my list, my list will be, I will right-click and then run Python file and terminal. Again, this example I write 0 and as you can see, I have four numbers inside this list. So hey guys, as you can see right here, this change it. Word is actually underlined it. So as Python says, we have, we will change the path list into this function. So the parts list is going to be changed. But as you can see here, I would like to repeat that with the def keyword, we define the function. We will say what will be the name of our function. And then inside the parentheses, we insert the arguments that are going to be used inside our function. So in this change IT function, I insert a list, while here I insert a string, and in this list I append these numbers. So finally, with the print built-in function, I print this string and then I print my list. What I would like to mention is the return statement, actually the statement return, exits AND function. So optionally passing back and expression to the color and this return statement with no arguments is the same as return none. So all the above examples are not returning a value, but we can return a value from a function as we can do in the following example. For example, we can define a function called sum that we will add to numbers num1 and num2 number one. Number two, I'm going to save that. I'm going to add two numbers and return the sum. So I'm going to use the variable total. No, yes, I'm going to use the variable total. And I will write num 1 plus 2. And then, and then print the sum. Is. And then print total. I will leave an empty space right here and then print the total. And then, I'm sorry, I'm going to return the total. So I'm going to use now this built-in function and tried total equals sum. And I will write the two numbers, num one in time to where it is. Really very good here is that when I'm writing the sum, you can see that now there is something like a command called sum as the name of my function. And if I'm going to open the parenthesis, then you can see that I have to add two numbers and return the sum num 1 and time 2 and num two. So I will write 10 and 20, and I will write print. I am printing again. The sum of two numbers is total. So right-click run Python, file and terminal. Okay, gems here, I will type 0. The sum is third thing and then I'm breathing again. The sum of the two numbers is 30. But what I can really do is I can write, again, use print, sum and tribes here for 5450. And these two numbers. So I'm going to print now the sum of these two numbers. Run, run Python file terminal right here. So I get one hundred, ten hundred, six hundred and fifty three. So as you can see right here, eats variable has a specific scope. So in this function, I use two variables and a total variable. But this is actually outside the function inside my program. And I am using again another variable called total that is accessible to my program. And I am adding and I'm giving the value of the return statement of this function. So these total, this value of this variable is being printed right here. And then I print again very term statement of this function. So I think these were good examples to understand the functions in Python. Looking forward to seeing you in the next lesson. 13. Sending Emails to multiple receivers with Python: Hey guys, Welcome back. Now in this lesson we are going to create a process that will allow us to send a test e-mail to any client that we might want. So first of all, let's start and create. Right here import, import SMTP library. So SMTP library, as you can see in the description, allows us to follow SMTP protocol, show that a weekend send a sample, a male. So as you can see here, it's also an example that will help you to create your own code in order to send email. So if you can use it, but let's try it together. So first of all, I have to EIP port SMTP library, and then sending an e-mail, I'm writing this comment right here so that we are going to have something concrete right here, sending mail, test, thank sample. So first of all, I'm going to create my methods. So I will use three brackets and I will say from, I would like from Christos Mali, Iraq. I will use the test in mail account. So I will use test in mail dot google.com right here. I'm going to send it to my G-mail account. So I will use my rack at X0 male.com. And then my subject will be SMTP Mail test. So SMTP is actually the protocol that InMail uses it in general, in general, when it is trying to send an email. So usually the protocols are SMTP for sending and PLP for incoming messages. So we're going to send an email. So we are writing SMTP e-mail test right here. And then the body will be, this is my first test e-mail. So in the end I have to close these three brackets. And then I'm going to initialize my server that I believe that it will use SMTP, lib dot SMTP. And then you have to define where is your server located. So actually, my domain be les.com uses these SMTP library. Website, will come.com, and then it uses this port. If you do not know, what we'd see is your your hosting provider, your Gmail account, your Hotmail account, what it actually uses, you could Google and see what are the SMTP settings for Hotmail or Gmail or anything else? So I googled right here SMTP settings for Hotmail. And you can see what, which port is used with server, IMAP, mail dot outlook.com. So this is what you are going to use SMTP settings for Gmail. You can use exactly smtp dot z mail.com. So you are going actually to write SMTP right here dot gmail.com. But I really suggest you to use my test e-mail account for your first example. So that I will put here my credentials. And this is a test e-mail account that you can use to share your test in males. So as you can see, I will write right here SMTP lib dot SMTP, VCs, my server, and this is my port. So then I'm going to connect server.js, connect. Exactly to this server. I'm writing this again. I will copy paste it. And then I will start with this. Hello. So this is actually we are going to create a new string object from this given object so that we're going to initialize our server and then I server start. The less. This is actually TLS is a secure protocol that it will allow. It will allow us to, to use TLS so that we can encrypt the rest of the SMTP session. As you can see, it puts the connection to the SMTP server into the TLS mood. So if there has been, a breach, has been no previous hello command, the session dries first hello. So actually we could omit the previous command, but it's something that it doesn't bother if you can use it. Show that we can have hello first command for sure. And then we will start sending the methods with TLS methods. So I will again now to my server. I'm sorry, I will again server.begin. I will write right here my credentials test in bilayers.com. Actually, if I'm going to say to overuse or abuse my email account, I will then change the credentials. So please don't do it. Do it only for educational testing purposes right here. Test in male at BLS.com. And then I will send right here, as you can see. And then I'm going to quit. So you can see right here, this is the code to send any mail test examples. So I'm going to right-click run Python file in terminal. So this is my previous example. Write something here. And as you can see, okay, I have an error. I have an arrow right here. Server. Okay? Unnecessary semicolon. Of course, in Python, I don't need any semi-colons. So again, run Python file and terminal 9. Again, I have an error. Login takes three positional arguments, but forward given. So 123, which is the fourth one, where it's the fourth one. So no, Actually, I need only two. Actually, this is server to send them email. And sorry for this, sendmail am going to send an email to this account, to this account, from this account and send this message. But first of all, I have to login to my server with this test. Let us.com and then use my password. I'll copy it and paste it right here. Exactly. So I'm going to save it and try again to run Python file in terminal. So I will type something. And everything was okay. Maybe I could add a message here, a male centered or something similar. So I'm going to my mail account. And here is my first test in mail. Send it from testimonial at Bless to my email account. And as you can see, I used TLS. Tls. So this is my first test, email. Everything went great. So this is actually the code that you can use to send any male 20 and that you might want. So thank you very much and looking forward to seeing you in the next lesson. 14. XML parsing: Hey guys, Welcome back. Now in this lesson, we will see how we can parse XML documents. So what is XML? Xml is actually a portable open source language that allows all the developers to develop applications that can be read by other applications. So XML is extremely useful for keeping track of small to medium or large amounts of data without requiring a SQL based backbone, without using a database. So there are specific XML parser architectures and APIs. And in this lesson, we will see how we can use the Document Object Model API dome. This is known as DOM. So it is a Worldwide Web Consortium recommendation where in the entire file is read into memory and stored in a tree based form to represent all the features of an XML document. So we will see an example. We will see how we can use an XML document, how we can read it with Python, and how we can parse and store the values and use the values in our programs. So first of all, I will open an XML document. Here is one high. As you can see right here, I will. So as you can see, so I have an XML document, I have an initial node called store items, and then I have three products. So as you can see, eats node opens and closes. So I have an opening node right here, and then I have this slash. That means that this is the closing node. And all these are, the value is the value inside this node. So then I have 123 products. As you can see, I have products. I have an attribute right here that it tells me that this product is for the item test TV. This product is for the item test phone. This product is for the item test DVD. Then I have the name of the product. I used the same name, but actually think about having a website and this item is for your personal use. So I can have something here for you that you can identify which product is, but here is the name, the official name that will be shown in the TV in the short-term, the website. So I can have something test TV, 49 inches, supermodel, something like this. This is the URL so that someone can click in this URL and see this product. This is the category ID. So it is the same as us in the databases. Think of having a lot of categories, and each category you have a specific, has a specific ID. So this product belongs to the category that has the IB 77. The name of the category is this show. Actually it is in Greek Civil Rights, something new. This is the price. You can have a manufacturer availability. So it is available. You can have something here, right for him. But I will delete this. I will also delete this. Right here. It is available. It is available. So you can see actually. I use these seed data. This is for very, very good for non-English languages, but you can also use it without all these, you can use this. For example, DVD player as here, category ID, the cash price. But actually if you are going to use an XML document for, for not Greek language, then you could use these data. So I will save it right now and then we'll start typing my program. I will start coding so that I will start parsing these data. These data from an XML document show. What I'm going to do right here is actually start using I will write comment XML document parsing. So I will use a DOM tree. Xml DOM.com dot parse. This is the syntax actually. And here you can type the path that your document is located in your hard disk. But be careful, I could use double slash right here. Users double slash, not once last but double-slit. Hp. This is my location. I'll stop right here. I did an example before the lesson. So I should tell you that first of all, you should import these two libraries. You should import from XML dot dom, dom, dom, import parse, and then import XML dot-dot-dot, dot-dot-dot dome. These are the two libraries that we will use in order to parse XML documents. This means that in these libraries that are all the available commands, all the available functions already built in. So that it will allow, it will allow us to use specific commands to parse these XML document. So I will go back where I was. And here I will use a variable called DOM tree that it will load the XML, the DOM Document Object Model, as you can see, implementation for Python. It does all the work for us. And then the medium simple implementation of the level 1 dome. So then I will parse this XML document and then I will use egg collection called DOM tree dot document, element Arabic that we say dub. You can autocomplete your command. So if collection says attribute, if collection, attribute self framed, root is I will write percent that S, that means that I will type here. S3, ink, show collection, dot get attribute. This one. Kid attribute. Selfies means that if I have an attribute in the root element, it will be predict right here. I will then get all the products in a collection. I will name the collection products. And then collection dot get. Elements by not by tag, name, named product. And then I iterate this election for each product, for product that it belongs in products. So with these command, actually, I use a new variable that it will iterate. It will go with all these products, with all these products that are in this collection. And then I can do, I can write here. If throw that says attribute, the attribute is named, name, then print item per cent, that's s percent, that's product, get attribute Item. So I will now write right here a print statement. Print, oh sorry. Products. And then I right-click, run Python, file and terminal. And I have a whole invalid syntax right here. So if collection says attribute itself, again, I forgot this one. And right-click run Python file terminal. Again, phis. Okay? Right-click run Python file terminal. So Type 9. So as I can see here, I have, I have a simple mistake. Actually, this is DOM tree, that document element if collection. Okay? Right. Okay, I have to fix this. So I will stop it for now, entitled continue with the next lesson. So that the error was in the XML document. I had to save it back and I will now run it again, run Python filing terminal. So this is my previous example. And as you can see, I have these products being printed. And then these products for each product have this products being printed. Actually, I dusted product. And then I have the title test TV, the title of the next product named test phone, and finally test DVD player. So this was an example where I took the attributes from the item. And I think it was a really good example to see how we can use the XML DOM in order to create, to parse XML documents. So remember that for eats node, there is a specific value and you can take this value by having either a reference where it will scan all the nodes and get the name of the tag name that you want or even the attribute that you might want. Or you can set the specific tree, the specific tree structure so that you can tell, for example, that I want the products slash product name or slash price and get the value of this node. So in order to do this, you can always shirts in Google and the dome. The dome structure says all the appropriate languages, all in all the appropriate equities, specific commands to use in order to parse the XML documents. And actually, these commands are almost the same. The same structure, the same libraries in all the programming languages. In Python, C-Sharp in C plus plus, you can use the DOM to parse XML files. So I'm looking forward to seeing you in the next lesson. 15. Multithreading in Python: Hey guys, Welcome back. Now, in this lesson we're going to see multithreaded programming. So running several threads is actually similar to running several different programs concurrently. But actually multithreaded programming. His even more benefits than running several different programs concurrently, multiple threads within a process, sir the same data space with the main thread and can share information or communicate with each other more easily than if they were separate processes. The second advantage is that threads are sometimes called lightweight processes and they do not require a lot of memory. So we can say that they are much steeper than processes. Cheaper in the resources that they need in order to be executed. Show a thread, says a beginning, says a specific sequence and execution sequence. And the conclusion, it has an instruction pointer that keeps track of where we V-in its context. Is it currently running? So it can be interrupted. It can also temporarily be put on hold, which is known as sleeping. While other threads are awake, are running. So we can have two different kind of threads. We can have kernel threads and user threads. And kernel threads are a part of the operating system while the user threads are not implemented in the kernel. So there are two models which support this usage of threads in Python three. The first one is thread that we will see, and the second one is threading. So we will now start a new thread. The first option, we will see an example. First of all, I'm going up and I will import, I will import thread, and I will import also time for my example. So these two libraries is something that you should also add to your example. I import thread and I pour time. I go now back in line 231 and I will write, I will define actually, I will define f function for my thread. And I will call it def print time, thread name Ax comma delay. And then I will count from 0, while count is less than five. Then time dot sleep. Actually, I have to put a tab right here. Times sleep for specific time called delay. And then I will count equals count plus one. And I will print two strings, that it will be the thread name and the time dot c time. With input Time.deltaTime, you will see that this is the current time in seconds. So this is where we'll see what it will be printed. So I have Time.deltaTime and then I will need these. These actually, I will use this format. So I have this parenthesis and one more parenthesis right here. So then I'm going to create two threads. Right here will be created. So the first one, I will try use thread, start a new thread. And I will print time right here. And I will print first thread, right? And then I will copy all this. And I will paste it. Starting a thread again print time, but this time to appease second thread. And this will be four. So this is and I will have an exception. I will try to handle it. And print. We have a problem, Houston. And we were unable to start threads. So yesterday I saw the movie with the biography of feeling Neil Armstrong. So I actually influenced from this movie. So I will use this whichever problem Houston. And then y one, I will use this infinite loop so that it will, it will actually execute the same command again and again. So when this code is executed, I will right-click ground Python file and terminal ai service index error, def print time delay. Yes, of course, I always forget this. And I will check it. Also this while count is less than five. So I think it's okay right now. Right click Run Python phylum terminale or K. I have 0, count equals 0.