Python for absolute beginners (road to machine learning) part1 | Michal Hucko | Skillshare

Playback Speed

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

Python for absolute beginners (road to machine learning) part1

teacher avatar Michal Hucko, Python | Docker | Kubernetes

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

21 Lessons (4h 35m)
    • 1. Introduction

    • 2. Python installation (Mac)

    • 3. Vs code installation (Mac)

    • 4. Python and vs code installation (Windows)

    • 5. Hello world

    • 6. Variables

    • 7. Basic data types

    • 8. Numerical operations

    • 9. String operations

    • 10. Lists

    • 11. Conditions

    • 12. Loops

    • 13. Custom functions

    • 14. Tuples

    • 15. Dictionaries

    • 16. Nested lists loops

    • 17. Exceptions

    • 18. Files

    • 19. Modules

    • 20. Standard input

    • 21. Project

  • --
  • 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.





About This Class

In this series of courses I want to teach you guys basics of machine learning and data analysis in python. In this first course we talk about absolute python basics which are essential for any further data science tasks.

This course is ideal for absolute programming beginners who haven't ever touched any programming language before. The course is also suitable for already experienced software developers who just want to learn a new programming language. Besides basics of python we cover code examples in the visual studio code, one of the best code editors in world nowadays. 

Python basics provided in this tutorial are essential for any further machine learning development, which I want to teach in upcoming courses. In this course i provide:

  • Step by step setup of python for mac and windows,
  • Visual studio code installation.
  • In depth explanation of basic python terms.
  • Best practises from real life python software developer.
  • Detailed explanation of difficult topics.

All the examples shown in the videos can be downloaded from my github repository

The course agenda: 

  1. Introduction 
  2. Python mac installation 
  3. Visual studio code installation (mac)
  4. Python and visual studio code windows installation 
  5. Hello world 
  6. Variables 
  7. Data types
  8. Mathematical operations 
  9. String operations
  10. Lists 
  11. Conditions
  12. Loops 
  13. Custom functions 
  14. Tuples
  15. Dictionaries 
  16. Nested lists and loops
  17. Exceptions
  18. Files
  19. Python modules
  20. Standard input
  21. Project

Meet Your Teacher

Teacher Profile Image

Michal Hucko

Python | Docker | Kubernetes


Hello world!! My name is Michal Hucko and I am passionate python developer. I am former university teacher. I was doing my Phd degree in computer science, however because of unfortunate situation I decided to currently postpone the study. Thats why I want to teach computer science online. Hope I can help you to understand the modern world of machine learning and distributed computing.

Besides programming I like to spent time with my wife, my brother and my friends. I am passionate fitness guy and sometimes I play computer games.

About my engineering career

For past 5 years I am working as a machine learning dev ops developer. I am working mostly with docker, kubernetes and python. Currently I am working for one of the biggest computer company in the wor... See full profile

Class Ratings

Expectations Met?
  • Exceeded!
  • Yes
  • Somewhat
  • Not really
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.


1. Introduction: Hey, guys, My name is Michael. Let's go. And welcome to the fighting for beginners tutorial The road Much learning part one in the series off course is I want to teach you the machine Learning in Beytin Exactly. In these course, I'm going to teach you some piping basics. I will cover stuff like Bipin variables, biting data types by two loops, custom functions and many more. These course is especially dedicated for those of you who are novel in program. So for absolute bite and beginners, I would also recommend this course for those of you who just want to learn the bite and syntax. During the course, I will cover some fight and examples into results to be a goat. In the course, I will cover step by step guide, how to install the beytin and resource to the coast old. The examples from these course you can find on the on my half page, which is link in the description below. I used to be a teacher at University. I was teaching personal programming and object oriented programming. I was doing research. The machine learning You can find some of my papers on the Internet right now I'm working as a machine learning the ropes engineer in the company. Right now some of you may ask Well, Mikel, But why is your of course the best one? Well, I'm not telling that my course is the best one. I'm just telling that in my course I woke over all the practical parts off the road to the machine learning. So if you are in this interested in this kind of stuff, feel free to join my courses. During this course, we will create the small tick tack toe project which will serve as a playground for you. Test the all skills which you learn through this course. Thank you very much for watching this video. I hope. Guys, I will see you in the next video off this course. 2. Python installation (Mac): Hey, guys, make up. Let's go here and welcome toe another video off Fightin for beginners tutorial. In this video, we're gonna talk about installation process off the fightin three for the MEC. Now, during this course, we will you spite and three. But feel free to use, bite into if you want or whatever version you want. I will be Specify only the basics off the beytin, which can be applied in each of the versions of the fightin. Now thes video covers the MEC MacBook instructions How to install the fightin eso. The electricity's off. This video are none. You only need to have your Mac book with the megaliths installed. So as you can see here I am using Currently, mega is Catalina Version 10. 15 at five and and I'm using 3 13 inch MacBook MacBook Pro right? Eso you don't need any like big hard for like bi gram and powerful CPU and GPU using your deodorant. Beytin You can run by two almost everywhere, even on old computers from 2000. It's up to you you're using. I don't recommend any any special notebook for these just tried out, and you will see whether you have some issues with the door? Not okay. So right now if you are in the MacBook, I have now opened something which is called Terminal. In order to open a terminal, you press command space and you write down terminal. Now when you open the terminal window, it looks exactly like this. If you specify the dark theme for the Mecca ways, if you have the light team, you will have the whites terminal. But don't worry, everything is the same. Just the team is different and off the court is different, so I won't go too much into details. Off terminal The only thing you need to know this is your user name beating the computer. And this eyes the at sign. And after the at sign there is the computer name for your computer. The steal sign stands for the location where we re sites right now. So right now we are in something which is called Home Directory. Yes. So if you press the if you put a command called open and inside there and and then put the space and that thesis will open the home directory for you. So as you can see the finder is showing us that right now we are here. Maybe you have eating these view. Feel free to change the view in the top. I prefer this one because there are a lot of details. So as you can see there at the desk of local and stuff like this, whatever you can be everywhere in the computer to run these. I just wanted to explain your some basics off the terminal. Okay, so right now, when you are in terminal and you're using MapQuest make us ships with the building bite and two version Now what about the versions? And blah, blah, blah? Yes, Everything is difficult for you right now. I understand. I think what you need to understand is what If you want to run a pipe and what should you do? You should bring into terminal the term fighter and this will open the interpreter. But don't press enter right now when you pull right down that Bytom space dish dish version , this is your output version of your beytin. So as you can see right now, the version is to that seven. That 16. In your case, you can see there something like apple in the briquettes or something like this. And it is saying you that right now you are using the bite and two from the apple right show. But in these course, I highly recommend you install the fight and three and how to do it. So first off, let's check. You don't have the fighting three installed. So when you put the biter three dash the extra version version, you should be presented with the pop up. A window from your MECO is asking you to install Exco dependency or something like this. Please press cancel. In this case, this means you don't have heightened three installed in your computer right now. If you have some apple version off the fightin, very feel free to continue with this tutorial. So there are two cases. You either are presented with error message most most likely if you are using the new version off the request or you are presented with some old old version off make or spite country. So the next step is to installation off the fightin three in order to install the fighting . Three. You have to go to Google and write down Brew will make always grew install, right? So and And right now you can go here to brew that s age. So directly press Hebrew, that sage study brew that not comma a sage. Right? And this is a homebrew. What is a homebrew? Homebrew is a make os package installer. So in the Because you have two possibilities, you can either instant wealth and possibilities. You can either install application from Apple store, app store or you can double the installer online or you can use these installation package Installation manager and Homebrew is a very handy tool and I very like it. So police feel free to use home brew. We will use homebrew in these courses on Lee for installation off the fightin, maybe in some for two courses. But in these scores on Lee to install the fight. Um, so how to Easter homeroom? I'm scared. I don't know What's homebrew? The only Deke. What you need to do is is is to install the homebrew and how to install the homebrew. You go to home page and there is the installation Whole group command you just copies Control C command, See, in case off Mike, of course, go to terminal and press it here. After you press enter, it will take about up to six minutes to install the homeroom and you will have the homebrew installed after death. Right now I have the home brewing start, so I m going around it. So feel free to post the video until the homebrew is installed. After you have the homebrew stuff, you can go and check it out by homebrew version and the home reversion will be Al. Put it for you. Yes, so I'm using to for all. If you are watching discords in two dozen 21 or later maybe you are using different versions. Feel free to use the actual version off the homebrew right which you have now. Homebrew is very simple right now you want to install the fightin, you just print brew. You just put brew, install biting into the home brew and press enter. After that, everything is finished. After the installation is finished, please feel free to close the terminal and opened the terminal again. Make sure you do this because you need to restart the terminal after installing something with home brew and after this process is finished, feel free to check out the fightin three version and right now you will see bite and three That's 77 installed. No messages from Apple asking you about installation off X code will be presented for you and you are ready to use the fighting. You can also open your first time first time Open your fight an interpreter. But put by putting fight and three in a in the interactive shell and you will see that the terminal changes into these three greater signs. And this is the fight an interpreter. So as you can see, you are using three. That's seven that seven Default blah, blah, blah. Nothing else is important for you three that 77 or three that later If you are installing getting a late three years and you can run biting comments here yes, If you want toe quit these Interpreter. Put the command quit with curly brackets at the end and press enter Now you are backing terminal. Okay, so in these video guys, I showed you how toe easily installed by 10 3 Using homebrew on your request, we talk about biting two and biting tree that sometimes make OAS ships with the vital to feel free to stop fighting three with the homebrew s. I shall be right now. So I hope this story will help you toe east. Tell your pipe and first time in your computer on the Internet, you can find many other manuals off tutorials. How to install it if they are up to date. For example, if you're watching this video later than I don't know 2021 2022. Please refer to them on. And this is the only break a product position off continuing with this video, you need to have the fighting and stuff. And we highly recommend you install the fighting three. OK, guys, I hope I will see you in the next video. Thank you very much for watching. 3. Vs code installation (Mac): Hello, guys. Welcome to another video off fighting for beginners tutorial. And in this video, we're gonna talk about the way how you can install resource to the OCO for your Mac OS or for your windows in this video. We specifically showed the examples in the make, but the installation instructions for windows are very similar, So let's jump right into the Google from and go to the website code that resource todo that come slash Download. If you're watching this video later, maybe the pepper changed, so please feel free to go toe wiggle and write down their MECO is installed. Resource to deal coat or Donald exhausted your coat. Now when we are in the Donald Section police, click the MEC version, which will initiated the Donald Process. After downloading the resource to decode zip file, go to your Donald's location and the unzip the Zip file. Download it from the spec page after the double click on the installer, which will be extracted and just transferred the icon of visual studio code to your applications. I'm not doing it right now because I have the visual studio gold installed, but as you can see these instructions are bigger for everyone. If you're using windows, just do the same thing for Windows. DoubleClick doing startle installer, and then the process is as simple as going next. Next. Next, agree and install Right? Nothing complicated. After that, you can find your results to the A goat in your applications for Windows. Also form a quiz showing the mega as press common space and write the s visual studio called the Pop Up Press. Enter and Israel opened a home screen off welcome screen of the visual studio code in order to work with the fightin with visual studio code s proficiently assess possible goto the extension pain It's here again. The process is saying for windows also for Mac, click the extensions and please write down here biting right. This will provide the older every level bite and extensions, but one of them is called the heightening station by Microsoft. Click on it and you can see we'll have more than $20 million. This is the most popular by next engine and is essential for you. It will help you. It will highlight the code. It will out of format the code for you. It will villus spend your ward off Googling stuff on the Internet and setting up please click installed under here after the resource studio code will install the extension, you need to rest at the visuals to go. So please close the results to the cold. Open the visual studio code and you are ready to do something. Okay, so right now we can start with the resource to the ago to set up everything necessary. So go to these file pain and click open folder. This will open you the finder and please create sama some fold. Let's go. The folder. Example folder? Yes, you can click on it and press the open. Now the results to the gold will open for you the folder and on your life side you will see the content of the folder because we created the folder. Right now it's empty. You can create a new file which we can call. Yes, the hello world that by in order toe use the fight and three which were installed in previous video In these resource to the goat on the left side, you can select which bite and you want to ruin toe. You want to run as I mentioned, May goes ships with to fight in spite into for Mac and bite on three, which we install right now. So, in order to switch between the Buyten's, you can click on this and as you can see, there will be two off them. One is the to that seven. That 16. This is basically the same thing on which is installed by the MacOS automatically. And this is the one which we installed. So police make sure you are using the fight. And three that seven at seven. 64 bit user local being fightin three okay, selected. Click on it. And this really abused for the copulation in visual studio code. You can also open the terminal in the top pain. You click on the terminal and you open the new terminal and thes terminal is exactly the same terminal which I showed you in the previous video. You can run the Commons there and you can open the bite an interpreter, everything there. So during our examples, I will run the code in resource to your coat. I will execute them in this visual studio code terminal if you want to cause terminal through please feel free to quit. Click it here on a click. The X here but native will close the terminal. If you want to quit the fight. An interpreter wide on the quit command. Basically, that is everything. The same instructions are for Windows pleasing. Still, the extension. Please make sure you're using the right fight an interpreter and it's everything. Guys, I hope you learn something new resource to the A coat. It's a very powerful tool right now. It's free for use, and lot of developers are working with it. And it's one of the popular, most popular editors. According to the Stig over full survey developer Solar serving My personal experience I have reached personal experience with the results does to decode. I am using it for the last three years right now, so I highly recommend you install it for you. But you're free two years, another different environment, a detour if you want. It's up to you. We will just around the fightin and editor has nothing to do with the cold, so it is just a nice tool to run its moakley. Okay, guys, that was very short video. I hope you understand everything if not feel free to contact me. I'll be glad to help you. I hope I will see you in the next video. Thank you very much. 4. Python and vs code installation (Windows): Hey, guys, welcome to another video off Bratton for beginners tutorial the road to the death of Science. And in this video, we're going to cover the installation steps off the fightin and resource to the code for the Windows users. Now, in the previous videos, I cover the installation steps for the mag users. But in this video, we're going to talk about windows. So because I'm using a Mac book pro, I will just show you most important steps which you can run in a in your windows mission. Right. So first of all on your windows mashing goto the google that come and boot there, uh, install. Well, Bytom don't load windows now, with the reason why I'm not going directly to the page is because you can watch this tutorial later and the webpage may change, or the euro may change. So please follow the steps along. So put it there, and now you will see that you there will be result on the on the bite on that work. Right? So if you go to the Dolans here in the middle, you will have a big button called Donald Fightin Tree that eighth Street. Okay, police on your windows machine. Click on this button. If I will click on these Dixville Dollars, the Mecca's version for me because I'm using Mega Mega s. But if you click on it on windows, it will download the installer for you for Windows. After that, you will have these common in style in stellar, uh, script. Download for your beytin For your windows, you can click on it. It will be in your dollars. Please double click it and open the installation Bizerte. The result will have couple of steps. But one of the most important steps is actually the 1st 1 where police take the option toe at the fightin executable to your part valuable place, you will see screen like this, please click added to the bath and proceed with the installation. After the installation has been finished, you can open your command prompt now common prompting windows is something similar to a terminal in my ghosts and basically everything would I will running terminal here in in my MacBook. You will be able to run from the common prompt on your windows machine. So if you open the command prompt and you put their the Command Beytin three Space Dash Dash version. You will see the version off the fightin installed in your computer. And as you can see, you will have the version three That eight. That's three. Yes, In the videos, I will use three. That's seven that but three. That eighties. Is this higher version off that and it's good enough for the examples which we will around in this tutorial. So please don't worry. Ran ended with three that eight or even higher versions. These makes no problems. Okay, now we have the fight and installed. We know what's the command prompt and we know how to use it. So we know to access the interpreter. You can just put their Titan and run it. Please beware. During the tutorial, I will use MacBook and I will write always spite and three. That's because my MacBook has to Buyten's installed the bite into and fight. And three feel free to use Onley fightin because Onley fightin will work in your windows machine. Okay, so don't be confused when I will use Beytin three in the examples. Okay? And let's dive into installation of resource to the A code. If you go to the Google back to the google dot com and you put their visual studio gold download. You will see a result of for downloading the version you need and please click the button under the windows logo. These ville again. Donald for you The installation resort, please around the resort in your computer again, The most important step in this case will be the screen where you can choose to add the coat to your open settings. So babies at the I think these two possibilities displayed in the picture okay, after the installation, you have the resources to decode installed and you can launch it. You can find me in your start menu. Opened the visual studio code. Now, when you will be in the visual studio code, you can continue without tutorial because everything will be the same. Increase off the results to the occult on windows and on May go s. Please beware the fact that you can also open the terminal in your results to your coat on your windows the same way as it is Amec. In this case, it will open for you the command prompt instead of the terminal from back. OK, so don't be scared. You can around the examples on your vetos and you can follow along on your windows. So that was just a very pre video how to install Titan and resource to do your cold on your windows machines, guys, thank you very much for watching. I hope I will see you in the next video. 5. Hello world: Hello, guys. My name is Michael, and I'm glad you're back. Welcome to the fight on tutorial for beginners in today's session. We gonna talk about your first script in the fight, and so sit back, relax and let's start show before we move on. Let's verify your fight on installation. In the previous video, I showed you how to install the fightin, using the homebrew for Mac OS version and, at the different way how to do it in Windows. So in order to continue, let's check out the fighting version in your computer again. This tutorial will be covering the mag book well, but the way how to verify it and how to code it is exactly the same for Windows and for Lennox. Before we started, I want to mention and you're in the whole session. We're going to use results to the occult as our main text editor, but feel free to use anything you want, but they have the record resource to the goat because it's cheap because it's for free. So, in order to very five diversion, we going to use again the terminal in case of the Mac OS, so press commands based and write down the terminal and the terminal window will open just like this. So he should be family or for you. Because in the previous video, I showed you how to install Homebrew with this. So now let's verify diversion and here gets the tricky part. When you ride the pipelines version, you will get the version off the fighting prevent interpreter installed in the computer. And as you can see right now, the version is to that seven at 16. But during these courses I mentioned in the first video we're going to use bite and three, That's seven that eight water version, but not python to. And that is because the meco is ships with the python to. But in the previous video, I showed you how to install the python with home brew and homebrew installed or also the pipe and three for us. So right now, when you go to five and three version, you will see the version three that seven that seven. And this is exactly the version which we're gonna use during all the future videos and during this tutorial and other future tutorials. Okay, so make sure you are using the pipe and three, That's seven again in case of windows. The same way you just ride out the bite then and you will get the version right or okay, right now. How we gonna run a script in The Fightin Show? Beytin can execute code and in many ways and one of the way it's strewed biting interpreter . Now I will not go into the details off the fight interpreter and how things work in the lightning Jupiter. I will cooperate in future videos, but the only thing you need to know right now is how you lunch the interpreter. So, he noted, launched into better. You just write down five and in this case, three. Because you're using Python three. Any presenter. And as you can see, the heightened version is being bring it in the first row with the pipe and three. That's seven in this case. Three. That's 77 and now you're running fightin in your computer. So everything which I rolled I will write Brand. Now it's biting cold. Okay, so let's start with your first ever coat, so it will be simple. It's gold a hello world, and you will meet the load off in many times with the hello world called during your learning off many different languages. Because it's like the traditional way how you will run your first goat is toe Bring the hello world in the language you are learning. So this of course won't being an exception. And we're going to ride the hell world. So how to do it? So in orderto you know, to bring something in Titan, you write the common print. It's fairly easy. And then you put the briquettes around briquettes and inside the brackets you specify what you want. The bite into print. Okay, so right now I want to bring the whole world like hello world. But the thing is, if you want to say something in Bytom like a specific sentence, fighting refers to the sentence as string. So it's a data type called stink. I will talk more about the strings later. The simple thing you need to know right now is if you want to bring something, you need to put it in double quotes like this. Hello world. So now you bring in the square records in round crickets with quotes The string Hello world . Any president Sorry and Harold Hill world. So this is your first bite on command your first bite and script, one line script. So as you can see in the interpreter, whenever you write, something in the line will be executed. So one line scripts are the best to run in the pattern Interpreter. OK, but right now you're like, OK, well, make how this looks silly. How what we lie. You spring for, right? But bring this very strong tool in the python. And a lot of experts are using the daily for the banking the code, you know, to finding errors in the coat. So keep in mind with hello of the print command is one of the most essentials, uh, in the programming world. Okay, let's dive into the visual studio. Go then talk about things in the visas to go. If you want to leave the interpreter, you just write down. Quit like this. And now you are back in in the normal terminal. Okay, so now you shut down the interpreter. Well, let's talk about the bizarre studio coat. Is I mentioned. So in order to work with the results to the A coat, you need to specify folder of work working folder for the results to the coat. And you can created easily with the with the finder. So if you go to the finder, press common space right down the finder and you open, just go to the documents and specify a bite and folder for you and the fighting folder will be will be the place where we will work with the coat. Okay, so now go to the visual studio code and this is the welcome screen. You will be greeted with swing order toe work with the folder which you created, you goto file and then you go toe open. Well, let's go to file an open workspace and then open the biting folder Open folder documents by then, folder open. So instead of work space, you need to go to open folder and open the folder. So now, at the left side, you will see the content off the folder. And on the right side here is the welcome. You can close the welcome right now. So on the right side here in the middle, you will see the file which you are creating. Okay, So left side is the folder, right? Now we need to create a fight on file in order to run something in the pipeline. Right. So just click this icon over here. It's golden. You file and name the file. I will name it. Hello, World that by Okay, now the file extension, its growth. Think after the dot Yes, with the duck. So in these cases, the by Because I'm referring toa a bite on file. Yes. So just keep in mind whenever we will work with fightin, we'll put that by after the name of the file. Okay, so in this case, the name of the file is the hell world. The file extension is that by because it's a pipe and file. Okay, presenter. And here the hell that by will be open for you. And this is a simple text editor. You can put their everything you want. And as you can see in the left corner, the results to the code automatically recognize that we are going toe use Titan in this case. Okay, Don't mind any warning. The right side you can just keep them. Maybe you will be prompt to install the fight and extension which I mentioned in the video for the visual studio Cold. Please install the biting extension. Just a quick recap. You click here and you put your pipe. Yeah, and I have it installed so I can uninstall it if you didn't install it before you can click on the instantly will be installed for you. Okay, so right now you go back to the file Explorer here the first, you know, thinking the tap and then you click the hello world and you out back to the whole world. You can close to extension pain way. I'm gonna use it right now. Okay? So now we are in the file called Hello World and we gonna run the whole world. And do remember, was the comment. Yes, it was simple. Yours to sprint and hello world, Right? Let's put an exclamation mark. Some of the guys are writing to exclamation mark in the whole world, so let's put it there right And now Well, if you presenter, nothing will happen, right? And this is the difference with one of the main differences between the interpreter and the fighting file. So if you're running a goat through the through the interpreter, you can run only one line script. And but this is a file and in file you can specify as much gold as you want, and it won't be executed immediately. In orderto execute this coat, you need to click here and go rent by. Don't file in terminal No before I click it. The thing is like visual studio code has its own terminal. It's these Think over here you conclude you can close this warning. So if you don't see this terminal, go to the Spain, click the terminal and and then click the new terminal and the terminal will appear for you . Okay, so but it's here if you're some. If you are in the pain called problems, just go to the pain called terminal. Right. And as you can see, the first line of the terminal is exactly the same as terminal ing, Max. So if I go back to Mac Terminal is exactly the same name, the user, the computer name and the folder where we had located? Yeah, exactly. We under the same folder right now. So the thing is like, if you want to run this command in these terminal, you right click in the middle of the file and you run, bite on file in the terminal, right? And you click Run. And as you can see here it was run like some strange things, some strange path, some strange command. And then the path to this file and the hello world was printed well, and now this can be a quite mysterious for you, for the beginners. Don't worry. I will cover everything about the interpreter and the visual studio code, how he's looking for the interpreter and things like these. The only thing you should know right now is like we run the code Hello world in the terminal, from the visitors to the occult. And now some of you you can ask me Well, me how you say there are two bidens in the neck, one which comes with the installation of the Mac and the other one is the homebrew bite and we try and stuff. How does the results to be a code? No, which I want to use. And the answer is simple. If you look left on the left button here where the fighting was written, the version of the fightin which the bizarre Scope studio co disease is using is written here and it's three. That's seven. That's seven. That's exactly the same fighting which I get after writing the by conversion here. Right. So the results to decode is using the right Bytom. If, because of some mistake, the Visoko studio code is using the different bite and you can just click here and select the bite on version which you are going to use, Yes. You can have here multiple times the same fightin. So just ran the user slash being slashed by the version which is here. Okay, click on it. And even Iran. Okay, guys. So peace was the hello world. Your first, your first cold in the fightin Hope you understand everything. If you don't feel free to ask me, feel free to write me a question. I I will cover also some sit ups for the windows. So don't worry if you're using Windows machines or Lin expressions for linens machines, we can give just the written tutorial because not many people are using Kleenex machines show. So this was for Mac. Thank you very much for watching this video. I hope I will see you in the next video. Goodbye 6. Variables: Hello, guys, and welcome to another part of our fight and being There's tutorial. And in these tutorial we're gonna talk about variables. So it's Dad with variables. So before we go to the bike than we need to talk about information in general. So the Bytom language and all the other programming languages are working in the with the information. Now, information is a very general term, and in order to be specified, we can define information. It's numbers, the words sentences, the audio. The is willing put right. So everything this everything like this is information. And in order to work with the programming language, the programming language must store somewhere the information and biting language stories, information in variables you confined variables in every other language also. Okay, so let's jump into visitors to the gold and look how we can define the variable. So I'm backing the visuals to the Lakota. As you can see this, you sell our hello world file from the last video and the I'm going to create a new file here so you can create a file two ways, like clicking here in the dope for new filer, right click and choose the new file. I'm going to call the new fight variables That's by I will provide all this coat to you through the page. They have the travel talk more moral more about They're get having the next videos. But just feel free to rewrite everything I'm writing here. And it's also a good exercise to rewrite everything. You will learn more with the mistakes you make. So I encourage you to rewrite everything. No, just copy. Paste everything from the website. So I mean the variables that by him I'm going to specify my first variable show. Let's go it variable. It's very general and let's assign. Okay, So if you want to specify a variable, the whole procedure looks like this. Now, having this, you will have a variable with name variable which is equal to one. Okay, so just remember, if you want to define a variable, you need the equal sign. You need value off the variable, and you need the name of the variable, right? In this case, the name is variable and the value is the number one. Okay. Very easy. Right. So now how would you define the variable with number two simple variable equals do now let but be careful. The second definition is the definition off the variable with same name as the first variable, which means it's the same valuable. So now you are reassigning the variable variable with number two OK, should just be careful. So in order to have two variables, you need toe name the second variable differently, like we're able to now. It's a good time to specify all the characters would you can use for defining the variable and the fighting. Documentation specifies the recommended characters as characters From a to set is a capital a capital? Is it the numbers from 0 to 9 and the underscore sign so you can combine these characters to create the variable names. Now, if you will go through a lot off other tutorials, you will see the teachers and you know the guys showing you that your first variable should be called something like X equals to something or why equals do something. And now, when I'm here, as you can see, you can put as many spaces you want between the variable name, the equal side and the equal sign and the value U. S so feel free. But I recommend, you know, using spaces. It's a good practice. Load off. You know, professional programmers are not giving the spaces between the variable name and the various volume. Okay, so I was talking about the Sikhs. And why variables Now, why is it this is bad? So you know, by phone language is free for you. You can do whatever you want. The beytin. He's not ordering you something. Yes, but there is something called best practices in the fightin programming world. And these best practices specify how you should write the names. And now these recommendations are very valuable because many times you are not alone working on the cold and there are other people were reading your coat. And when you will call the variables like X and Y, nobody will know what is this variable used for? Also, the name workable is not good for is not good to use. I highly recommend to use some escape the variables, for example, like, uh, number off rooms equals Sorry. Space equals one, right. And now, whenever you will see these variable into cold, you will immediately know that these valuable is used for specifications off number of rooms or for example, for example, Name off the some. Yep. So and now whenever you will see name off the son, you will know that these variable stands for name of some sound. Right? So And now when I'm here, the numbers are not only know the only that a type you can use for specify the variable value. Yes. So now I told you that the second part is the value which is always certain that a type so one is that the type of number And imagine you want to use a variable for the name off the sand. So in this case, you will specified like this. So let's go. It may help. Right? And now you have avoidable with the value off string, Andi, with the value of strength with the value off Mikel, Right? You remember our hello world program There we have something like brains. Hello world and the hello world, which I mentioned is a string and the definition is exactly the same as in the meal case. Right? Okay, so now we know that these are the valuables is of course, you can use also the capital of letters and you can call it something like a number of rooms equals to do. And and now be careful. The number of rooms with the capital and and number of rooms with lower and are two distinctive different variables. Yes. So these two variables are no the same. So be careful. So, like a vital language is very sensitive for the capital letters. And you can specify as many variables just by changing the capital letters in the middle. Also, when you specify number rooms like this, this is also another variable. So these are three distinctive variables specifying the different number. Right? Okay, so So this is the way how fighting can store the information variables. But now yeah, let's say you want to run something. Yes. You want to see some output? So, for example, if you ran this coat just like this with the round fight and filing terminal, we won't see any output. And now the reason is we didn't specify any command for vital. We just specify the variables. You remember the hello world way put their the function print. Yes, bring was a function because it has this round brackets. So in orderto Yes, for example. Now, now we want to know the value off the variable number of rooms. The 1st 1? Yes. So what do we do? You will just run the print command with the variable name the number of rooms. Just be careful to correctly rewrite the name of the variable into the function print. So, like this. And now you can ask me hell Well, but where are the double quotes? Yes, like the Hello world, which we did last time. And the answer is simple. In case you are printing a variable, not just the information. You don't need to specify the double quotes because the fight an interpreter will replace this number of rooms with the value off the bar global behind the scenes. Now, if I run these, I get that. But what will be the output in this case? You know, How did you get that? If you say number one, you're correct. So as you can see, Number one is the output because these number off rooms was replaced with the value off the variable. You can also bring another worrying news. So as you can see with those to decode is recommending us the variable names which we can choose from. So these are all of our three variables. And in the first case, I'll put Thesis one the number of rooms. And now I want to output. For example, this one with the capital running, I will get one and three because the capital has three inside there. Okay, so this was just the brief about the variables. We will cover more about valuable variables in the future video. The key points you should take away from this video are you can use small letters, capital letters and the underscore signed for specifying the variable names. You can rewrite the definition off the valuable when you specify the same name twice in the program and you can output the variable in the print as the print is replacing the variable name with variable value behind the scenes. And I also showed you we shortly talk about the data types, but we will cover more data types in the future. So, guys, thank you very much for watching and I will see you in the next video 7. Basic data types: Hey, guys, welcome back to the tutorial. I'm glad you're back with me. And in this video, we're gonna talk about other types and maybe I will repeat something about the variables. So let's jump right into the coat. So in the previous video, we were talking about the variables irony, some comments in the variables that by let's change something, let's go to the fighting. Interpreters opened the terminal and write down Fightin three. Yeah, in case you are using make and you were doing the same thing is I was doing in the video with the installation instructions for the MECO is you should have the python three interpreter and bite and three command in case you have it under the fightin, you can run fightin just to be sure when you right around bite. And three, the interpreter view will output the first line with the version off bite and being used. If there is something like biting do just change the interpreter to python three and be sure that despite country were using python three that seven in this case. Okay, So before we were running commands in the file and when you're doing it in the interpreter is basically the same soul. It's just repeat the thing with the variables number. Sorry. Number off rooms equals the drink Print number off rooms, you see, I think amazing. In case of interpreter, you don't need toe. Put the Brendan front office off in front of it. So if you just run number off rooms, you will get the output immediately. Right? So that's the main difference between the file and the interpreter. So now let's run cold in the interpreter. I will provide you code in the file after the video in the description, Right. So don't worry. But full along again. Try to rewrite it right in your own. The errors are important for your learning process of the world. If you see some mirrors. Okay, let's talk about the data type. So if I ous I told you last time when you have something like this when you press the arrow up, it will provide you the last command you specify in the interpreter. So when you have something like this, number of rooms equals three. Now you are assigning the valuable off the death attacked number, number of rooms valuable. So again, if you run it, and now we want to know time. And in the fightin there is a special function called type, and you can put the name of the warrior boo inside there, and it will provide you with the class or the type or the data type off. The given valuable so as you can see at the variable number of rooms, is off the type or the class, and it's stand it stands for in teacher or the simple numeric data type. So let's change it. A name off the sun was equal to me. Don't forget the double quotes, please. Yes, so now we have name of the son. And when we bring the type name of the Sun Sorry, I mis spelt So as you can see now. Now, this is the great time to learn from errors. When Beytin receives an error in the interpreter part, it will bring out something like name, error or typo error or something like this. So error will be there in the last line. And what is he saying? He's saying Name, error, Name Die away, de y O. E is no defined. What does it mean? It says that there is nothing like a function with name DE i o e. Yes. So I made a typo in my cold here, so I will just quickly fix it. Read it again. And as you can see, everything went smoothly. No error there. And the data type is s the r stands for strength. Yes. So another basic data type is drink. I want to cover one more that the type which is essential for a future learning. It's called the bowling. That a type? Yes. So in every programming language you have this bowling that the type and it's stands for for the value off the truth, whether something is true or false, Yes, so imagine like I will specify a variable cold Easter Monday. So today, Sunday So this Sunday and I will said it. True as you can see, true is not the strange in this case because there are no double calls. So true is a special world just like print function or the type function which stands for a bowling value. So now I can assign it to be Sunday. And when I go bring peace Sunday, I will get through as you can see no double quotes immediately. True. So this is the bowling. If I goto type is Sunday, I will get bull class bull so bullying What is the Oppose it off the true. It's false, of course. And when you want to specify the false, you go like specify a new variable Cold is Saturday. Saleh today equals two false And now when you bring this Saturday, you don't need to specify bring You can just do it like this sort of Saad. Third day I put the A inside there, as you can see again, name error Amazing. We are learning from our mistakes. So I saw your day bulls. So this was the bull in value, right? And and now now I was talking about the numbers. So let's go back to numbers. I cover just the in teacher. Some of you may know that in another programming languages there are different kinds or data types of numerical values. So let's cover this a little bit. So, for example, if you don't want to have, ah, the number like one. But for example, you want to have a number like one that five. Yes, so with these that values. How can I specified in fighting? You can do it like this so it's really like special number equals to one that be sure to use the dot instead of the common five and special number. I misspell it. Special number one that five. And what is the time in this case? Float. So when you are using the duck numbers, the data type is flowed when you are using the normal numbers. So so without the floating point, it's the in teacher. So this is the main difference between the numbers. Yes, of course. There are also complex numbers or different kind of numbers in the vital, but we will cover this light furious. Right now, you are good with bowling's strings in teachers and the flow numbers. Yeah, when I was talking about the bowling's, I say something like a special word. The rectum for these is called the Rivers work reserved ward. And in the fightin there are some special reserve words, which means the these air serv boards are reserved for bite and specific functions and fightin specific calls right, and you cannot use these words for a specifications off your variables. So, for example, we were talking about the true value, right? You cannot specify a variable with name True and said it, for example, to false. Right. You cannot do this because this is a special worked. Yes, as you can see can assign a keyword. So there is support. This sometimes referred as a keyword. But we can call it the wrist rewards or keywords. It doesn't matter, right? I also don't encourage you to do something like print so called the very variable like print and sign there some value like that. Yet you can do these vital loves. You do these, but then you will rewrite the functionality off the brain function and you cannot use the bring. The normal way is before, right? So don't do these. There are a lot of rest rewards in the fightin, and I will cover all. I will provide you a link with the rest of boards in the description. Through the tutorial, we will explain a lot of reserved words for fighting. So don't worry if you don't go to this place because it's big for you or do you have time for this or you prefer videos instead of reading right it's normal. I also prefer videos instead of reading. So that was everything about the basic data types? Don't worry. We broke over more about it at the Times in the future. But in order to move on with all the new topics we need to cover these basic data types. Hope you enjoy it. And I hope, guys, I will see you in the next video, So goodbye. 8. Numerical operations: Hey, guys, Welcome back to the fight and tutorial for beginners. My name is Michael. And in this video, we're gonna talk about numerical operations in the beytin. This topic is one of the basic Suplee. Sit down, Relax and full along. While I'm showing you the code in my computer, I highly recommend toe ride the coat on yourself. It's always and of course, I will provide the source code for you. But Onley, in case you get totally lost, please copy paste the code to your visual studio coat. Okay, so let's dive into the visual studio coat. In this case, I have pre prepared some examples off numerical operations in Beytin. As you can see in these in these visual studio cold fire. So here I have created the file called numerical Underscore operations that by again noticed the syntax. I'm using something called Camel case, which means that if we have a name off the file, which consists of multiple words, each word starts with a lower case and between the words instead of space I'm using underscore these camel casing tax for for the file name Spite on file names is used worldwide in the fight and programming community. So I highly encourages you to use these syntax for naming. It's called naming conventions also. So we're looking to the file. We have a couple of simple operations always being assigned to a variable cold value in the previous videos, like Over the Value, the variable syntax and the way How Biden assigns the value to the variables. And here you can also see that always imprinting the value off the variable with some additional text. So I'm extending the brain function from the province. Previous video with value. Well, when im are using the function like this, it's like the bite and will always come Captain eight value off the variable at the end on the string and put their the space right. So we can we can just simply ran these command. But before we do, let's first check out what's the value of the first variable. And here is the simple one plus one operation. So in this case, the value off the variable value will be too okay again. Then we have the division, the this obstruction, the multiplication, the division and other stuff like this. Okay, so before I explain each of it. Let's just check out the output off this file to run the file just right. Click in the middle again and ran. Fight on file in terminal. These will open up the terminal in resource to decode. And because I'm using big fund, can I feel the whole screen? I will open it a little bit more. Okay, So as we can see in this part, here is the beginning of the line because I have the big screen. You can see it. So if I just open it like this, you can see that a year. The Python three interpreter has been invoked with the file name Numerical Operations. This is the whole file to the numerical, polite operations, a path, the corporations. And as you can see, the first print is here. It's called addition and do and it affairs to these. Line the second line into Bezos to decode So edition and the value was too, because that's the result off one pass one Okay, one minus one is zero. That's correct. The third operation is the multiplication. So one times one is always one right. So it's it's one. Then I'm showing you how toe divide something right. And in previous video, I was talking about the types. So, as you can see, when you divide these two whole numbers, so then is a whole number and five is the whole number you will get the to and two is in general the whole number. But the division will always return a float type. So that's the reason why I'm always also accept the wrestled. I'm also printing the type off the resulting value. Right. So as you can see, a whole number, division is too and the class is fault. That's refers to the line nine indivisible studio cold. Okay. And now I want to show you what happened. If you divide if the result is not the whole number but the real number. Yes, for example, then divided by three. So it's an irrational number because it has endless, you know, the floating point. So the result is three. That 333 is here in these line. And as you can see, the class or story, the data type off the value will be again float. And then in this file on the line 14 and 15 I have something strange and these hedged back refers to comments now comments can be a broad topic and I will cover it later. But right now, the only thing you need to know about comments is that whenever a bite, an interpreter will see comment line in the file. These line will be ignored during the processing, right. So these lying won't be evaluated in the output. Even not, the operation will be evaluated and even not process, so nothing will happened. So the interpreter will just ignored the line 14 and 15. Right Says you can see the zero division value is not printing after. But the exponential operation is being after because after that, we have the exponential operation world value. Right? So I will run also these lines. But first, let's go into the open exponential operation. So what if you want to race some number in the power off to write? So as in this case, I'm raising the number two in the power of to and the result should before and the result is for in this case, it is these lines over here in the output, right. And then we have something which is called module module in the programming language stands for one special operation. So imagine you have something syntax of written like this. So 10% for you can read it as 10 Model four and the output off this operation is the is the rest after the division. So it's when you divide 10 by four. The result should be to that. I don't know to the five, right. But you know, if you want to get the whole number division, you should only have the two, so you can rewrite them as to times the number the division did usual. So two times four plus the rest to right. So the model in this case, the right tone, the value off the rest. So in this case, it will be too right and deads written here I will go into more examples of model later, but let's check out the another opposite off medulla, which is the floor division. So for division and these will rate or the number doing this case so So it from these excavations it will stand. It will return the value too, because it's it's the number off times you can multiply the division in the number you want to divide it to right? So in this case it will be too right. So let's going toe into examples with the examples. You will understand it much better, right? So let's ram the examples in the terminal because we want to practice also your terminal skills, not only the visual studio code. So go to your terminal again. You can write comments, space and right terminal and opened the fight. An interpreter. So again, right Beytin three and the and now a sign of value to something or or in the fighting, the interpreter. You can directly right your equations so you convert two plus two equals toe four. Right? So then model four equals to two, right? So the rest after the whole number division off then is too. So that means if I increased this to 11 what should be the result you can answer? The result should be three, right? So if I ran it again, it's three right? So now if I have 12 model to model for what should be the result now, this is a tricky because you can divide valve by four without any arrest. So the results should be zero, and the result is zero. Exactly. And now the floor division, You have them four. Division, for the result is what in this case, how many times you can feel for into 10 two times. Exactly. So the reason why is two and okay. And how about 11? What should be resulting this case again? It really began to right? And how about wealth Four. What should be the result in this case, right? It's three because you can feel three times the number four in the number 12. Okay, The model and floor division can be the complicated concepts in this case. But I hope you understand it with these examples. Now come back to division. Right? So in the mathematics, you cannot divide zero with any number. Yes, because it makes no sense to divide zero with any number. So what will fight and say us be tried to divide zero, but by any number, So zero divided by let's say three will result in zero. Right? So no problems. Okay. And if we want to assign it, do we value zero divide by three and bring value the value zero right, Fine. And if we want to divide something with zero three divided with zero. You cannot do that in mathematics will return something, which is an error. We encountered a rose in the previous video and this is especially There are It's very descriptive. It says zero division, air or division by zero. So Bytom, uh, except the rules of mathematics. And you cannot divided by C grow. Right. Let me show you one more example. If we go to resource to the code and I will recommend these things So we want to welcome and something you just delete the hash tax before it and you re right it like this. And we ran it. We should get the error. Right? So this is a good example. How to train yourself it Errors surround fightin filing terminal and a Z I have scrolled down. Here is the point where the fightin three was called with the file again, Right? And as you could see at the back, we have the zero division error, right? So now we run the file envy, receiving their NBC an error message. And now how do we know where the error is? Yes, we know it because I just putting their artificially. But sometimes you have in your file on error, and suddenly you are receiving error messages and you want to look for the error. So if you look at the at these text, it starts with trace back in. The fight on this is called trays, and it specifies the position off the error. So sometimes it can be very easy to find a mirror, and sometimes it is very hard. But in this case, it's very because if you look in here zero division by zero, then the line is being printed where the ever happened. So value slash zero right? But sometimes you have to file toe beak to look for the specific line. So vital also provides the exact line where the error happened. So it says the error is at Line 14. Help, please. Chander Figs there in round the file again. So he says, Here is the so in order to fix it, you can just zero divide by three around the whole file again. Okay, find guys. I want to show you one more interesting example of how fast can the competition being the fightin. So imagine you want to do the exponential operation, right? So you have to raised by number two. So in these cases for right. Okay, that was easy. Even you can do it in your head. But how about two raised by hand? It was it. Fast. Immediate results. Inviting soap item is leveraging the whole power of your CPU to run these operation in your computer and give you the results. And it can be very fast, even faster than your calculator, you say. Well, that was easy. My calculator can do it also very fast. So how about Dubai 200? You can see very fast. And how about two by 1000 can see immediate drizzles load of numbers. You can trust me. You can trust the fightin is always right. So you get the number, right? So you can try these example in your computer to see limits of the computer when you will increase and giving more and more zeros at the end. Suddenly, it will take some time until the result will be provided. But I will keep this for us and training an example. Two tried in your own tried limits of your computer. A computer. It's different it really depends on a number. Of course you have in your computer. And how fast is your CPU and stuff like this? So please feel free to check this out. Okay, guys. So that's everything about the mathematical operations in the vital I hope you learned something. You. Now you can use the fight an interpreter instead of your calculator. So hope this video was useful and we will continue in the next video. Thank you very much for watching. I hope I see you again. 9. String operations: Hey, guys, my name is Michael. Who's going? This is another part off the biting beginner tutorial. Thank you very much for joining in and in the day session. We're gonna talk about drinks. Well, I covered something about strings in the previous videos, but I think we need some more information to be family are with everything with almost everything we can do with strings. So yes, of course. In order to explain everything, we will not have enough time. So I will cover just the basics and through the rest of the tutorial, I will get going to further details. So sit back, relax and let's dive right in tow. The visual studio. So, as you can see again, I have prepared the file called String Operations. You can find this file in the link in the description, but I highly recommend everything, and I will always repeat it to write down the code by your own. So I will run. It may be too fast for you. Feel free to browse the video and ride the coat and be 100% sure you understand everything . What is Britain there? Yes. Don't be just this guy who is just opening the code and saying Yes. Yes, I really do. I understand you will not remember it. You have to get the coat into your hands and then through the hands get the cold inside your head and that's the right place Where the gold needs to be in the sink is also so let's that be in today's video, we will call a rural a lot of stuff. So first we have the simplest drink. So the string is defined between the double quotes. So the words between the double quotes This is the simple string. One more thing in the visual studio code. If you go to the terminal and you don't see the terminal down there, you can open the terminal with the new terminal command. Now, these terminal is exactly the same terminal as you see here. So everything you were be ableto right here. You can also write in the in the visual studio coat there Milius. So when I run and and one nice heck is too right Python three here and now you got the interpreter running inside business to do your gold and when you want to run something from the results to the A goat. You just highlight it and press ship command. Cheap ship Enter. Yes, Shift Enter. So as you can see, two lines were executed in the sequential way. So first line was here strength and then the string was printed. And as you can see these his strength was printed out. Yes. I want to show you one most important difference between the running coat and using the interpreter in the terminal. So if you just put this is drink inside here and ran enter, you can see that the strength was out. Put it in single quotes. So in order to get rid of the single codes during the output, you need to write bring string, as I did in the previews. Example. Cold, right. Okay. In the line three, we have string defined in single quotes. You can use single coals and double colts. Now, the reasons there couple of reasons for these so sometimes is good to your single quotes because you want to use a double quote in your strength. So something like this is 100% valid, and sometimes you you just to do it in the opposite way. So use the double so used single quoting double quotes, right. Find that this is the second thing. So this is thinking single quotes now in orderto you can use also, the single called in single quotes by using these backslash. So if you put back slash in the middle of the single quoted strength, you can escape It's called escaping character the value of single quote Because we doubt this These will end the string and this Bukos and errors so introduce single quote character in single quotes Think you just need to escape it like this. So now you will be able to run this? Yes, this is single quote in the single quotes drink right you can do with like with double quotes. Yes, there are some examples. I will keep these examples for you to run dried out on your own. I will skip through them right now. Right? So days away how you can, you know, split the string into multiple lines using some special characters so backslash and stands for new line. So if you run this drink, you will see that the strength has been split it into two lines. Right? So there are a couple of special white characters, you can find them on Internet. I will use a couple of them during the tutorial now, uncovering just the basic one and feel free to go to Internet and tied down so white special characters in fightin and you will get the least off something called white characters or the characters like this with you can't feeling toe the strengths and and do them the special function. Right? So this is the top sign. So this will, you know, split the string into multiple lines and the another line will be formatted. Well, sorry. So youngling 13. So when I will not running like this, I get this is drink with new line in the top, right? So then you can have the tricky strings like, for example, the file path which consists at the back slash. And this can cause, for example, in case off windows path to behave wrongly. So in this case, if you run, the streak is drink bad, you will see the path was out. Put it in two lines, but you don't want to do this. So in this case, you can use something which is called a raw string, which is just ignoring every special character. So if you ran it like this, you will see that the Bob is printed exactly as we want, right? And then you can specify something which is called multiplying strength. In order to specify a multi line strength, you will have to use these three double calls in a row or three single calls in case off a single quote. It's drink. So if I replace it with a single quotes, it will do exactly the same thing. And then you can specify these multi line strength. So if I around these you will see I got these multi line strength. But there is one minor catch. The multi line strength will be separated with new lines and the beginning and end off the end, as you can see here. So in order to get rid of this, you will use the back slash at each line. So if I ranted like this, I won't have any new lines there. So if I really this one, I will have the new line on Lee at the beginning. Can see Okay. So as you can see again, I'm using comments inside the file. And in this case, I'm using comments to, you know, to express something to give you information. So, for example, if you will look bag in, tow the file in a couple of weeks and you will forget about this video you can just briefly recall What is this part of call doing? So now are we gonna use the string operation, right? I don't have time here, so let's first talk about the concatenation. Now, what is concatenation? Socom? Captain Nation is an addition off two strings. So a single simple string contact and coordination example can be the hello plus world. And guess the output. Yeah, just just try to write down. Really? This can be maybe a good example right down the open. Now I will give you a couple of seconds. So what will be the output off helpless world? Yeah, I guess each of you has written Hello space world. But if I run it, it will be hello world together because there was no space in here. This is very tricky. Many times when I'm writing this concatenation strings, I always keeping like in mind. When there is a plus, it will always put the space there. No, no space will be there if you put here space in this case, the space will be there. Here. I want to show you that you can also go on. Captain ate the variables which are strings. So, for example, I have a variable called string Hello, which consists off the string Hello and string world, which consists off off Strangler. And if I ran it like these, I will get the hell aboard again. Yes, it makes sense. Variables consisting of strength are basically strings itself. So it's possible to go on. Captain ate them with the with the plus sign now bite and provides a tricky way to concoct Nate Toe, You know things like this. So nothing in between Come, Captain ating two strings. This is also valid syntax infighting. But I'm not using it because it's very tricky, because when you, for example, want around the cold like this? Hello, stink. These will cost in error, right? Because these is not supported syntax in the Biden. So, uh, if you can see syntax, error invalid syntax, right? So please don't use it. Well, you can use it. You can have just this information in your head. I'm not using it. Feel free to use it if you want. So in order to work it properly, you need to put the plus sign in between the string and the variable of strength. Right? Like this? Yeah. Like this. Okay, uh, then we have the multiplication, and you can multiply strength when and number. Right? So, for example, these will output three times height in the role. Yes. So you can imagine the multiplication the same way as addition, like three times high space. Plus high spaceballs. High space. Yes. So you can do it with everything and also valuables. It's up to try it. Yes. Don't just think about it. Tried right down into your computer. If there isn't there, think about the netter. If you don't know how to figure out, their goto will bring down the error and look for the answers. There we will cover how to find and track the errors in the fight and future videos. So stay tuned for it Well, and then weaken dog now about stringing numbers. So basically, number is not the same data type a string, but fighting provides you way how to work with it. So in the previous video I was doing something like this or printing the strength and the numbers. So the brain function laws us too to go on. Captain ate the string in the number without any sign like these. So if you run these, you get number. He's six and this is Street because I have not specified the space here. But when I use the coma here inside the print, it will automatically put the space there. Your support now, I was talking that Plus is not putting the space and this is putting the space. Why's fightin doing this to us? Why is it so confusing? Why is it so hard? The word guys, you will get used to it. Just try down and you will learn with your errors, Right? So don't worry about your so you can do also something like this. So number is six and some additional additional sprink, right? So the to one I have to I like the 321 go Number six additional strength, right? But right now, let's try something different. Let's try the plus sign between the string in the number just like these Israel Costanera. I never want to show you out. What for? In the areas type error. The fightin is saying you, the fighting is speaking to you about your errors. So listen to the fighting. I have met a lot off beginner programmers who are just ignoring the fighting terror like I was teaching one year at university and I had the students and they were just, like asking, like, Why's is not working for me And they had this letter in front of them and they were just blanked. They didn't read the air because they were scared of errors. Guys, errors are here for you to learn. What is the air sink type? Error can only concoct in eight string, no end to string. So what does it mean? The string plus the in teacher is causing problems. So in order to over cos you need to changed the type off the in teacher Yes, we will calm or about types and changing the times dynamically. So So, basically, just the only thing you need to know if you want Teoh to convert its called conversion So, like in the business, convert euros for dollars right So if you want to convert this number two so the integer intern into the string you need to use something called strength Esti air constructor function. So you put the SD air and records You put the number now this will be valid. Common. Run it. You can see number east six again. Pull seven. No space red. So but what does this mean? So if you bring the type off six What will be the South? It's from previous video. It will be in Teacher. And now, if you put the type off the SD Air six, our six would be the upward string. So now we converted the main teacher into the string. This was maybe a lot of information. Feel free to pause the video and ran it on your own. Okay, there is another like a tool with strings. We just called for mated strings. You can put the number directly into the strength without even transforming it. I like very much this approach. I'm using it daily. It's helpful. So, for example, if you want to put the Sikhs inside string at the given position, you can write something like this and this is a very powerful tool because inside the break it's you can put every bite and common almost every bite on command, which is returning some value. So, for example, these six plastics will return the teacher, the addition, the result off the sun. So if I ran these you up well, amazing. And you can also concoct another think at the end. I put it here just for example, deep breath in the breath out. Feel free to posit for a few minutes we will continue. The next thing is indexing off strings. Now when we are talking about strings, we are talking about, ah, bunch off characters. Yes, So the letters, numbers and special characters the underscores yes, dashes spaces. So this is everything strength and internally by item, it's creating an airy, so set off. Be careful. Centenary is different in fighting, but we will call it an area or a list off these characters. So each string is basically a list off characters. Many off you met with the expression off area may be with us in some different languages. In this case, Beytin refers to string as an area off characters, so that means, let's say, we have these instructor strength? Yes. So it's a list off characters and we want to access the first letter in the string. We can do it like this. It's m right, because the first letter of my name is him. And now, be careful. Titan is indexing strings, right strings with the number zero. Not with the number one s citizen Matt Lap. Other than under the programming languages, it's from zero. So the first letter is a zeroth position. The second letter is at first position. The third letter is a second position and so on. And so please make these mental exercise for you. And please remember that everything is eggs indexed from zero. So if you now want to know the type off the first letter what it will be what you think it will be, it will be string, right? So age leather is also stink in this case. So instructor three will be the fourth leather off my name. Now, when you use minus van, you're referring toa last letter. Yes. So when you're using minus your indexing from behind So what will be thes minus one? It will be Oh, because there is no minus zero from backwards, you are indexing from minus one. Okay, so this is, like, complicated. I know you're getting lost. It lost into these. Don't worry. Feel free to run this code as many times as you want with different strings. And try to guess the output before you run the coat. Yes. So this is the minus one. And now you can refer to the set off the off the letters. For example, you want the letters starting from zero position and ending at sixth position. And again try what will be. And when you run it, it will be my first name. So Mika? Yes? You want to refer on Lee so you can reread these cold the same way as this. So if the first the starting position is zero, you can admit it. So this is a story. This is exactly the same as the previous command. Now, this is a tricky What will be these out. Maybe some of you say it move your whole name and surname, but no the's will. And at the the second last letter So without my last letter, the whole string you can contact in a these guys together. What will be output of peace? Yes. So we want from starting from zero position at the second position and then from the second to the end. So these will be my whole name and you can also do it from backwards. So starting at the minus four position to the end off the C minus four upto the end off the street. No careful. Beytin loves the lows us something to do and something Not before example You can do something like this. I want the letters from second position Up to 103rd position. Yes. So Israel Hallow. These will follow a spy pen and it will stop at the end without sing in the error. So this is a valid command. This is also valid. Common. You can start somewhere far away. And you want to continue somewhere even further. This village for nothing. So this is an empty string without anything to output. Right? But what fightin doesn't allow us is this so if you want to refer toa single letter outside off the list, So 45th position, right? This will cause an index error. Sprink index east out off range. So It's a miracle you are trying to access the later outside off the length off the string . This thing has only I don't know fan letters And you are trying to access 45th which is a way you cannot access these memories. Yes, you are restricted to these Onley toe the limit These things was a lot of information about things guys I know. Just feel free to, you know, absorb these information. Try the examples with your names with the names off your girlfriend Boyfriend, brother, Sister will never I hope you enjoy this video. Things are amazing. I like these things. I'm using them daily. So feel free toe. Have some time. I hope I will see you guys in the next video. I wish you a nice day and CIA. 10. Lists: Hey guys, Michael Holtz, go here. Thank you very much for drinking the Bytom for beginners tutorial. And in this video we're going to talk about lists. In the previous videos, we talk about mathematical operations, the string operations, but now lists well. Let's can be lived with trickier because because lists, you can imagine lists as storage for multiple variables in the same time. So before we were talking about variables which are a single place, storage is basically and the least I can, you know, can store more than one worry abou. In the same time, you can think about it this way. So let's jump right then into the hands on in the results to the occult. So before we started, As you can see, I'm in my results, too. The a coat. Here are a couple of other Biden files which were created for you. They will include a lot of examples training examples for you, so if you have a spare time, feel free to go through them. You can find them at my good lap, get bait, so let's go to the lists. As you can see, there are a couple of examples with will go one by one. But before we start, let's create the empty file. I call it the hand zone, where people run a different command spite and commands. So, in order to run, the command says we are always doing civil. Use the results to the occult. You need to show the terminal in the bottom part of the terminal in visual studio code is exactly the same toe the terminal as in the MEC. So if you go here to the terminal, you got the same terminal individuals to the A coat, you know, to show the terminal goto terminal pain and choose the new terminal option if you don't see this terminal, right. So this terminal is amazing because he loves us to select a cold from the Bytom file and then ran it oppressing the shift plus enter keys so I will show you. So let's start by the finding seat. Least Let's going numbers and out there some numbers and these are numbers. 12345 Right, So you got these list and then just we're gonna bring the numbers. So in order to run the biting cold correctly, the results to the local terminal. You need to go to the terminal down here and right. 5 10 3 This will initiate biting interpreter. And now the Commons from the file will be copied, pasted directly to the interpreter and run. So let's dried out. Select these two lines. Breast, sheep enter. And as you can see, a numbers name numbers is no defined at the first line. Yeah, Yeah. So as you can see, there is a syntax error. Are you all right here? Missing the coma running again? And then you you always have to scroll down to the bottom because the comments will stack one another. So the second time I run, it is the sprint. A certain is that the brain That what? There was there. But here is the numbers. This is the specification. The first line, and then the bring numbers. Second line. Okay, so So from now on, I will only ran the commands is followed by selecting the code in the results to the golden pressing shift. Enter so back to the lists so you could see how at least looks like. So it got C stop square brackets and the content inside. And these are the least elements at least elements can be any object any data type. In this case, I'm using numbers but feel free to adhere strings like for example, Mikel, May I hel and running it thus follows. You can see I'll put the least like this with the meat. Hell at the end. Yes, there. Is that the type called least So if I go like this in Iran, just last line I get it's a classically so whenever you are using, least you are working with the class type list on it doesn't matter. What What is the content off the list? Right. So let's go toe release that by now when I click here, you will see a bunch of code and maybe you will get lost. But this is a good exercise in your programming can carry Here you will met with the code off other people and it's a great time right now to start to read the coat. Whenever you will look for some solution online, you will see other sculpture. You need to understand how to read the cold. Okay, so basically here I d declared the same some number least and I just output the type off the list. Then I declared here something which is string list. So basically, if I call it string list, it doesn't change the type off the list. It will always be the same type. I'm just I'm just giving the write the script variable names, which is a good exercise for you whenever you are creating a valuable or at least give it appropriate name in orderto for someone else to understand your call Now everybody who will see the variable because this is again a valuable and I'm assigning the value off the variable toe least right. So everybody who will see now the variable names during place will immediately know that. OK, there is a list and there are strengths inside. Maybe is of course, you could call it number least and then, you know, treat the guy and put their some numbers. But I don't recommend doing this because then everybody in your company will be angry with you. So combined list. As you can see, you can put the bully and values inside there. Even the floor values Yes. Visual studio code is also showing you that this is a load value. Now, accessing the elements off this. Imagine you have this list, Will Ronnie. So in the number list. So if I now go back, you can combine the cooperation between studio coat you confront, tickled by pressing shift, enter from the file and you can directly interact with criminal down here. So now you can access it from the terminal under the coat just like this. That's the reason why I liked the cells to the occult with this, You know, this is so the dynamic programming you can called in the results of your golden the interpreter in the same time. And you can see the immediate results. Yes. So dry out, guys, run the commands. Do it on your own. Don't just look at this video. Rewrite the comments on your own. Post the video. If I'm going too fast now, least indexing it means accessing the parts off the list. Now, before we were talking about streets and strings are basically like lists. Yes, so you can access the string letter by using these special briquettes with number. The position of the letter and as it is in the strings, also lists the position is indexed from zero. So right now I want to see the first element off the numberless because zero stands for the first, Ran it it zero? Yes, because here the number list has the 1st 0 You can specify a range. So for example, right now I want the third element up until the fourth element. So if you can see, it's only the third element. And the thing is like when you are specifying the range, you are specifying an interval, which looks like so the closed interval from three up to three. Open. Yes. So everything which is greater and equal than the second index and less than 36. So basically, it's just a run number. So if I changed two for now, I will get to numbers. Right. So the third and and the fourth position, right? Okay, lets go. You can also, if you go like this as as it using the strings, you will get the 1st 3 elements off. The list is the same. If I go like this, sorry. As again, you can access the last element on your or you can. Okay, so So this will give us the last element which is. You tell me. Seven. Exactly, exactly. I forget to hear the break it so you can at the break it here it's the 70 s. And then you can you can specify the range starting from last elements. Now I want to specify a range starting from the second last element up until the end off the off the area story off the lists like this. There is one more ticket for us. Six and seven. Amazing. If we come next, you can come, Captain. Eight to least so exactly A cities with drinks with a post sign. So if you have the number list which was defined like peace these at the top and then you out there 879 And if you print it out you go and you get the previous least plus the three new elements from the new list. You are a pending to it. It's called concatenation in this case. Now let's talk about mutability and mutability in the fightin language or the heightened. You know, the programming language guys use sometimes the term in mutability and suitability of all Basically, that means you mentioned you have I will explain it with the example because I am not into these theoretical terms. So imagine you have a string gold best teacher. We just me hell, Let's go, Michael, Let's go! And the numbers, which is a list. And now strengths are immutable and lists are mutable. And what does it mean? So if you have Motaba list, you can change the element at the first position. So now I'm changing the element in the first position attempts. Let's first around these two commands to have the valuables in the memory and now changing the first element element in the first position. Then and now guess if I bring the numbers, I will help them at the first position. Amazing. But now you cannot do something like best feature zero and said it, too. I don't know. And so now I want to adjust the strength because the strings was called best teacher at the first position toe end. And if I ran these, you will see I'm getting a type error string object doesn't support item assignment, and that's basically what's the mutability and mutability. So the mood table objects. You can adjust an immutable objects. You cannot right fire, so we will come into these guy and let's go Next slice assignment. So I was talking about about these, so I was keeping right now. So basically, you are using the slice indexing. It will start with the closing terrible and finished with open interval. You can change also these positions. So, for example, I want to adjust in numbers. Thes thes two guys. So? So I want to adjust the second element in the third element in this case and rewrite it to 12 and 13. Right? So if I run the numbers, you can see there is the 11th 12th. But you can also you know, you want to change two elements, but you are assigning three elements. And these real just brought the list. So it will add these extra 13 in the middle. So if I run it like this and if I run it like this, I can see it added this 13 at the end. And you can also deleted by providing empty, empty list like this. So I ran it. It's empty right now. Let's talk about in place Operation versus noting place operation so assigned it to two numbers. So what are in place and noting place operation. So, for example, you have these list and now imagine you want to upend one and two at the and off the list. If you run it like this, you are not changing the variable and their numbers because these operations will return venue list, as you can see right here. But because we didn't assign it toe any new variable, we are not getting the We are not adjusting the number. So the numbers, as you can see, will stay the same without the one and two. In order to assign it, you need to create a new variable or the same. This can be also numbers just numbers new and assigned the result off the operation just like this. So if I create a new variable numbers new and assigned it to result off numbers plus a new list, we will get the newest Exactly you can eso. So now some syntactic sugar in fightin the term syntactic sugar stands that you can create certain operations many ways by changing the syntax of the language. So these guy over here, this comment it's exactly the same as these command. So if I run it like these instead that now I'm assigning it to numbers. So these guy over here, So I'm changing numbers by adding one and two at the end is the same as if you righted like blast equals like this. If I run these and no look at the numbers, it's a pendant. Redd fight. You can do it the same with the teachers. So by being plus one to number of notes, which is specified zero at the beginning, that's not the problem. So this was not in place operation because you need to do a sign, a variable with the result value. But there are some in place operation. For example, you mentioned you have numbers like these. So now if you look at the numbers, is just from 0 to 5 and now you want a pent 10 at the end, and upend is in place operation, which means you don't have to assign this to somewhere. It will immediately adjust the valuable. And now, if I drink, it's right. It's very good to have in mind these in place and not in place terms in order. If you are looking for something at the vibe, you know which vocabulary to use to put into the into the Google. Okay, now there are special functions connected with with the lists which are directly built into vital. So it provides for you. So let's let this cover. For example, you have these least called numbers, and now you want to get linked off the numbers least. So if you press gets was the output, it's six. Exactly. Now you can get let off the string also. Then you can remove something from from the least Bice by by calling the function call, remove with the index so the position and which you want to delete the items. So, for example, like this Now, if you look into the numbers, we'll be dead. It's old, starting from one. Exactly. Now let's talk about pointers. Imagine you have, like, a variable numbers assigned to a list, and now you will assign a new valuable So the old valuable. So now the same numbers will point to numbers, so the same numbers will after these have sorry will after these have the same value. I may selected it so one more time, so the same numbers will have Now what so If you go to the end and you build, like, print the same numbers, we will get the's list. And now, if you adjust the same numbers toe, then so you will change the first position and you will bring the same numbers again. You will see that the first element changed from 0 to 10 but not only these element, but also the element in numbers. Original numbers. And that's why because when you are assigning a variable toe variable, you are pointing from these variable to the old one, and you are changing also the old one. It's quite complicated. Take a time to absorb these information. Look at the coat and and think about it. Yes, you are pointing with the variable toe aboard old viable, and you, when you are adjusting the new variable, your immediately adjusting the old variable. That's the reason why both of them changed. Yes, I will have the print here for you. Just you have a complete now in order to create a copy off the least in the new variable unit to call the copy, and in this case, the old variable will not change. For example, if you ran it like thes. And we assigned the first element then and we're looking to the old valuable. It doesn't change now. You can have elements in least off any kind of object, as I mentioned, so you can put a list in tow the list. So this is a list which has the numbers in it, and these element is a list. And this is the second element is a list in which is again a list with the element of fire crazy stuff, right? Don't worry, guys. Just think about it. Pause the video and look at the court. Now we want to get the last element. What is the last element off this list? What do you think? So I will assign a value to the variable number and lists numbers and lists. And now I will retrieve the last element from numbers and lists. And it is thes guy over here, because that's the last element off the out, at least, and now you can access the element in the element so you will change chain these brackets like this. So we want the first element off the last element off the numbers and lists. So if I ran it. What will be the answer? Three. Exactly. It's three. Try to get only the number five as an exercise for you. Feel free to take your time and think about that. You can change these records. As I said, it's very easy, so if you listen carefully, you will do it immediately. Now other least functions. Let's talk about letters. You can have a least off letters now if it considers. Name off the amazing teacher, so letters and now list off letters is not the same as a strength. Right, because stream is connected, list of letters in one place and least is immutable. List is mutable and string is immutable, right? So there is a function called count, which counts the occurance off the element in the least. So Mikel hopes go, How many seas are there or there toe amazing letters. Extent these will upend least at the end off the least 11 sort you up and elements at the end of the list right now. Just think about it. But what is the difference between upend and extent? Let's check it out so you want to upend one and two at the end of letters. So if I run it like these and if I look at the letters so there are you see, they are put there. So the least waas contact concatenation and the elements off these least was added at the end. And now if I really like this Yeah, and think about this is in place operation. So we are adding it toe changed letters, right? So if I run it now, you can see the element was added as as element off with the value off least. Yes. So the main difference in one case you're adding least as an element. And in other case, you are a pending elements off the least toe hold to the newest right. You can remove excess from list. Yeah, not least As you can see, there will be the value because there is no eggs in my name. But if I change to see on and ran, need you will see its It's not there. Yes, you can insert at the third position at the at the index three. You want to insert X with this command so you can see there is an ex at 1234 position because three stands for index tree, which is the fourth position because we are indexing from zero. As I mentioned, you can reverse the least. In this case, the least is reversed and you can Bob, which will will be ready to the last element and remove it from here. So if I run it began, you will see there is no more em right. You can clear the whole East, but this will be the least for us. It's empty, fine. And there is also a special function which is a sort function I will cover, maybe sorts in in future chapters. Understanding the source isn't is say, essential in the programming language, because sorts are used in every like framework in every technology. But right now, you only think you have to know if you have, for example, number least like this in Iran, sort function upon it again is in place functions, so the numbers will be directly adjusted. So if around the sword and now if I run numbers you will see they are ordered in numerical order, right? And if there are multiple elements, that will be just, you know, chain one after another. That was a lot of information. We help, right? My right. Exactly. So you need to take time. Go. Maybe through this video, 2 to 3 times really depends on your on your skill in programming. Thank you very much for watching this video, guys. And I hold I will see you in the next video. Goodbye. 11. Conditions: Hey, guys. Megahertz, cohere And welcome back to another. Video off are biting for beginners tutorial into this video, we're going to talk about conditions. Conditions are one of the major blocks in every programming language, and bison is not an exception. We will cover everything from if statements toe else statements. I will show you one line conditions and many more. So let's jump right into the resource to the A code again. Well, with you around, couple off are examples. So if we go to the results to the A code, if you can see, I have prepared for you again another filed core cold condition that by which you can find at the get help page in the description below. So I over a couple of them before we start with the conditions. Let's recap something about bullying data types. In a couple of previous videos, I have talked about the bullying data types and pulling that the type is one of the basic data types in every programming language, so the bulling other types can have two values and one of them is the true and the second is the false statement and they, uh, and they can be specified with the keywords through with a Capital D and false with a capital F. So having the variable name is programmer said to value off, too. And the student said, value of false the type off this program will be, in this case, bowling again. If you want to use the Fightin Interpreter from the visual studio code, go to the terminal. You can open a criminal from here New Terminal and right down the pipe. Three keyboard to run the interpreter. Now you can run the Commons by selecting them from the file and pressing shift. Plus enter on the Megan, also in the windows She plus entering this case. Now we set variables, and we can get the type by highlighting the diapers program and cheap enter. And, as you can see, it's bull. Now the syntax off off condition is a little bit different compared to other examples, which we ran. So you said the if statement the condition in the first line off the if statement, and here we are comparing the value off the variable is programmer to true, and if this program are this programmer, variable has the value off to the body off. The conditions will be executed. Now to distinguish between the body and rest of the program. We need toe intend the coat. And in this case, we're using top indentation individuals to the A coat. You can specify the top indentation clicking here and India and using spaces. Yeah, of course, I said up, but like we are using the indent off the top, replaced before spaces. But basically this is a common practice across python programmer. So please said the indentation to four spaces in this part off the results to the coat. If you are using any other environment for writing your coat, feel free to Google the right way helped to set up the intonation for four spaces. Things will make it much easier for other programmers to work with your coat, so we will intend the cold with four spaces. And now, if I ran these highlighting these impressing enter, you can see the output off its programmer because previously we said the is programmer to true. Let's said that is program with the polls. Well, we can just compare it to a student because this is set to false. So if I compare it to student, nothing will be up. Put it because the context condition waas not through right. So coming next we can haven't else we can, you know, extend the condition with the else statement And now the body off the else statement is again indented with four spaces and will be executive on Lee if the condition is not true. So now we are asking if it's programmer is set to true. But because we didn't change the this programmer and it still said to through the body off else won't be executed In order to execute the body, we need to set the East Programmer comparing toe falls. And in this case, by running this condition with the else statement, we will see that he is no programmer is being printed out now. Yes, As you can see, these makes no sense because the logic was that if this is true, we will bring his programmer. But by changing this too falls the whole else statement doesn't make any sense. But feel free to test on your own. Tried to run some conditions with your code and you will see fine. You can also change if statements if conditions. For example, having these conditions, we are testing if his programmer is set to false and when is not set to false then after that we are testing. If the student is set to true. So the execution process goes like this. First the beytin will ask, Is the programmer set to false? If this is through, the print is not programmer will be printed. Then it will go toe else statement. If this was not true and it will ask OK, so it's programmer is said Toe is not set to false. So this programmer said true. And it will ask. Is the students that to drew? If yes, these will go and if not else statement will be returned. Now, I know this can be quite challenging for you to understand in what in the short time, but again, I recommend pause the video and try to think about the statement and try to run a couple of cold with different settings for a student and this programmer, and you will see how easy it is to understand. So let's go. My question is, if it's programmer said True and a student is set to false. Which part off the condition will be run? It's programmer, he said to drew it means this condition is not true. We will go to l statement. And if student is set to false which means this condition is not true. We will go to l statement. So it's programmer and is not Students should be out. Put it? Yeah, of course. When you are using if else l If statement individuals to the occult, it will call you some errors. In order to run this call properly. Police open a new file copy, paste the whole condition And don't forget to initialize the variables at the beginning like this. Now you can run the whole file by right thinking in the middle file and run fightin in the terminal, please. Before running that quit the interpreter by writing the quit. Now you are in the terminal and you can around these cold by running these guy. And as you can see, we got the East programmer and is not student. Now let's go back to condition. Go back to the Fighting Interpreter vice by writing 53 and continue with our examples. So we were talking about Bowling's Now you can get the value of bowling's with some political operations. For example, you can compare to numbers with less sign, and now we are asking is five is less than four and the answer is false. So if I run this command, you will see I get written about value or false. If you go and type to output the type off these, you will get the bull fine. You can ask whether something is greater or equals, or whether something is equalled and something else. No, the In the fighting there is something which is called an East operator. For example, let's go to the hands old part, and you can ask whether, uh, number you can ask. Number is five now, Basically, in case off numbers, you will get the same result as you will if you will replace. This is with double equals, because be careful when you want to compare numbers. Whether they are equals, you need to use double equals because one equal stay stands for assignment, and then the fightin is unable to distinguish between assignment and comparing. That's the reason why they chose to equals instead so. But I was talking about the East. So, for example, you can compare to a raise. Let's say we have these two arrays I will copy pasted to the hands on part for you to see better. Let's have these two areas. You can compare them by simply running to command number Least one double equals number is leased to now. The question for you is what will be the Al pulled off this because the estuaries have the singler elements inside there. If I ran these, I will get through. But now if you replace it with this, the output will change the false. And the reason for this is that is is comparing instances. If the if the left side is the same instance as the right side now, you can be, like, now, confused little bit. But under the terms, instance, What does it mean? The instance. But basically the fighting is asking Where did the variable number Least one is pointing out to the same memory place as the numberless to, and because these two were created separately, they are not pointing to the same part. Now the question tricky question for you. What should I do in order to have these false. And if you remember, last time I was talking about pointers when I was talking about the lists. So the solution for this is quite easy. If you just replace this definition off. Number two with number two equals two number list and this is the pointing definition. Now the variable number two a number least two will point to number list one and the in this case, both off the variables will point to the same place in the memory. For this reason, the ISS will return true, right? That was quite tricky. Question. You can find his example in the get up. I highly recommend to stop pause the video and think about it Now. Buyten's provides you at the way how to negate the output off the variable or negative help out of the condition. For example, having the least programmer set true, we can negate the value off the East programmer by reserved keyboard. Not so these direct false. Now you can use everything which I showed you here in the body off the if statement as the conditions, for example, if not his programmer, plane these and then print this. So in this case, the else statement will be run. He's a programmer. Exactly. Now you can also change the logical operation as in a logical functions. So, for example, they are too reserved boards. One is aunt and one is or now you are asking if this programmer is set to true. Now, as you can see, I'm not using this index like this because syntax like this and syntax like this is exactly the same. In both cases, the way we are comparing the retool return value so written value off its programmer will be true. So I don't need to compare it back again to true. So if it's programmer is said to do and this student is set to true with the opening is a student programmer, right? So in this case, board condition must be too. We can run it. I didn't specify student. I forget around these two lines and now when I run it begin, I will get the first body, the first part of the body of a condition because because the condition part was true. Now you can use the estate man and or is the logic corporation or nothing difficult? Everything simple let's now talk about implicit Boolean values. Now some of the objects in the fight and have implicit Boolean values. For example, you can you can replace the true statement with the one number. So if we go to the fightin so you don't use Spuyten, use Python three in run one equals two Drew, we will get through because one eyes the replacement for two in the fightin. The reason for is for this is that many other programming languages, instead of using true and false, are using zero and one. In this case, a pipeline is using the syntax in both face. So you can either use true or false or zero and one. So just check out zero is equal to falls is true. No, Everything which is greater than zero is equals to through in the fight and implicitly, for example, to is equals to false. Okay, don't worry too much about this. I will cover some more examples in future videos right now for you is that the intuition is that the only intuition I want to build in you is that sometimes we don't need to use to win full statement in step. We can compare objects for the bullying values. So for the implicit police values, there are some examples here with numbers and also with the areas I highly recommend you to try on your own, which I won't cover just for the sake off experimenting in your computer. Now let's talk about one line if statements. I really like this featuring the Beytin because I'm from the other programming languages such as chalice script. I'm used to into these one line statements. If statements sometimes called a stationary operators and biting provides this ability also . So imagine Imagine you have variable called this programmer like this set to truth. And now you want to have a variable called this programmer strength which will be in case off the is programmer is set to true. Being set toe is programmer string and in case it's not set to true, it will be said is no the programmer don't mind this part. This is just a comment right so you can write it two ways one way the whole If else statement way is like this. So you are asking if this programmer is set to true, then set the If programmer is programmer String to he's programmer. And in case of this is not true. Send it to his know the programmer. But instead of writing these long coat, you can write it in one line using these statement. Now, let's trick it out. If I ran this cold, I will see that the print is programmer. Strength is is the programmer. So if I said false, I will see the opposite one. Now, please beware the fact that you always must specify else statement. You cannot just omit these because in these cases, the bite on interpreter vill race and exception. As you can see. Syntax, error invalid syntax. Okay, guys, that was everything for today. From the conditions. Hope you enjoy it. And you learned something new. I wish we will met together in the next video. Thank you very much. 12. Loops: Hey, guys, welcome back. My name is Michael, and this is another video off the tutorial for biting beginners on our way to the data science professional. So in these video, we're gonna talk about loops Before we started. Let's recap a little bit in this course. We already covered some basic that the types we talk about string operations, mathematical operations. We talk about conditions in our let's talk about loops. So one loops also with the conditions are essential, building parts of each programming language and let's dive into the examples into visual studio code. So, as you can see, I'm in the file coat loops, that path by which you can find my get happy with Dr providing the description below. And for the sake off example, I will use two variables. The 1st 1 is called Numbers, which consists off a standard, least with numbers, which I explained in the previous video. And the 2nd 1 is letters Where are strange characters? 111 correct long letters in the in the in the list. Now let's go toe loop in the fight, and we have two main loops. One is called the Four Loop and the other one is the while loop. So let's talk about for loop. So four loop consists off the definition and the body. So basically, the principle is the same as case in the condition, as in case of condition show in the four loop we are using the keyboard for, followed by the alteration variable then in and then the thing which we want to eat through the variable which want military through in this case. So we want to reiterate through each number and now the four loop is running the body in loops for each off the object waiting, the waiting, the variable we want to trade through. So in this case, for each off the number, the body will be assigned. And now the value off the given number which the given loop is running for, will be in the variable cult name variable cold number in this case. Okay, so we are iterating through these numbers and every time the number has a different value. Based on the situation in which we are currently so in the first iteration, the number will have value off one in the second. The value off number will be too 34 and so on. Sounds fairly easy. This is very simple example. Let's run it. So in order to running resource to the accord the python code from the file You need to run the interpreter with running fighting three. Now we are in the interpreter Now select the variable which we want to A ran a story. Let's run pulled off them So now we having memory our variables and then we can run the loop presenter. So as you can see, the content off the numbers was printed into the screen. If I adhere something like then highlight the rennet and dinner and loop. I'm always pressing Shift enter to run the selected go This always know when the group has these dots Here you need to go here and press enter. And as you can see, the 10 was output it fairly easy. Before we move on, I want to teach you some Heck, imagine you want to have a loop which will go for example four times and you want always to have the alteration variable toe have the value off these numbers. So you want to create something like a counter and because toe, right. These long area is too handy. You don't have blood off time. For example, Imagine you want to try to hundreds of examples. You don't want to run these least with hundreds 100 element. Beytin provides us some building function called range and range. When you ran something like these, we'll create a range with the length or four. So if I ran these evil return something called arranged object, right? Or enumerators so we don't see exactly list. But we can transform the strange object into the least with the function list. So when you ran, arrange object within the least function it will return. The area started from zero up to the upper border, which is in this case for but because this is an open interval before XX close it so you can specify the range also like that, or if you don't want to start with zero, you can start from one. The third parameter off the range function is the increment. For example, if you want to start from zero in commenting by two up to 10 you can run the range function like this or you can Vikram in like this Yeah. Feel free to experimental, deranged function. You can create least as big as you want. Andi, why am I talking to why am I showing you this example? Because many times you want to reiterate through these range. So, for example, let's right. The function, which will output numbers starting from zero up to 10 increased by two. So this is how you can write it simpler without defining the big least aside did in the previous example. So, like these. So that was the fourth group. As you can see, you need some object to Italy. True, the the other thing theater loop used in the fightin is called the wild, and the wild loop is based on the condition. So until a certain condition is through, the loop will run. But when the condition is force the little full stop, let me show you an example. For example, specify a variable cold counter and set it to zero. And we want to run the body off the loop up until the counter is less than equal than five . So and always, we are printing the counter. So as you can see, the body will be ran every time the condition is true. So beware that I'm always incriminating the counter at the end off the body off the wild. Right. Without this, we will end up in infinite loop, which will cause problems to your computer. So please don't forget the last line in order you know to somewhere fulfilled the condition when you will. Amid these, you can try it yourself. It will suddenly bring up 0000000 all the time because the Louisville infinitely run and as the fight an interpreter is very fast because your computer is very fast, you will see a lot of zeros. So let's let's start around these coat. And as you can see, we have the numbers starting from zero up to five and educate, See, because I specified the condition that the counter should be less and greater than five. The five was printed also, if I didn't specify this five, so it's an opening drivel. The five won't be printed again. Feel free to experiment. Write down your own lips. You can put here any condition you want. So you remember the the condition video from a if else statement video from last video and try to feel here some some different conditions. You can also put here aunt and or the same way as the else statement was set up. Okay, Now let's talk about break. So sometimes you're in the situation that you're running the loop and you want to sometimes break the loop, for example. Look at this. As I said, you can put any bullion in the condition part off the wild group. So these case, we are saying that we want to Peter it forever. And we reached these by providing the true as the conditional perimeter off the wild. So in this case, the while will run forever. But but so we are printing the counter and at the end of the body were always incriminating the culture Discuss that we are implementing the value at the end of each cycle. Yes, but look, here's an if condition. And these, if conditions says that if the counter is greater or equal than five, we want to break the loop now. How does the break knows? What do we want? Toe And the brake is always looking for the context where it recites and in this case, it recites in the context off if but if it's not a loop. So it is looking outside off the if, and it sees that it is in the wild. So it knows that we want to terminate the wild look in this case exactly. So basically this is exactly well, not exactly the same, but it's exactly the same as these via Loop. So what will be the output in this case? What do you think will be the five? Output it or not? Let's run down a Z. We can see the while loop printed also the five. Now let's go step by step So counter is set to zero. That's the line 28. We goto 29 while hope is set to true, through is always through. So we go to the body now print counter, we bring zero. That's the first CEO. Then we go to the if statement If zero in this case is greater in equalled and five, is it true? No. So we don't go to break. We go to line 33. We increment the counter and because we are in the wild, Look, we go back to the wild condition true is always through. We bring the counter in this case, it this one. Is it great Returning cold and five No again increment. And so on someone up until it's for imaging. It's for now we have before. So we print the four and we go toe even leave this if statement Is it true? No, because for is not greater and equal than five. So we incriminated by one and print the five in the next. Now you see it. If we move this counter behind the loop behind the condition, we will end up with different output. And in this case, the output will be what you think. Zero up until four. Exactly. So I hope these these step by step while will help you to better understand how the wild Because Okay, let's go to another example. Do you remember how I define the letters at the beginning? They consist of my name. So my name's letters. So now we want in thes example over here iterated through letters and if the letter is not equals to see, we will output the letter. So let me just copy paste this letter definition closer, so you will see what is exactly happening. So look at the so how the four loop works once again. So it always assigns toe the letter variable the given value off the pitch aerator. So in the first loop, the letter will be equal toe m Now we go to the body. If m doesn't equal to see bring a letter and is not equal to see So we will bring the m why we go to the next iteration. In this case, the letter will be equal to Why is why equal to see No, we are printing then C c is equal to see. That means we're not printing anything and we are directly going to the next iteration with age is age equal to see No, we are bringing the age is not equal to C l is not equal to see So both of these guys will be up Put it Let's try up as you can see me Hall without see Waas output it So the correct pronunciation of my name is Mikel to be great Now there is also something which is called Continue right and what does continue do? Let's say again. Three bridal letters close to the definition so you can see it. Let's see, we go step by step In the first iteration, the letter will be equal. Toe em if em is equal to see It's not We're skipping it. We are printing the letter. But what if see? What if the letter is equal to see? In thes case, we are skipping the rest off the cough. Look, body and we are going directly to the next iteration. So the continue will skip in this case the print function and will directly go to the next letter. Yes, So that's opposite off break. Basically, break is breaking the whole cycle While the continue is skipping the given. Luke is keeping the given in situation and is continuing to the next situation. Sounds fairly So guys that waas the four and wild group in the Beytin hope you enjoyed it Home You learn something you feel free to experiment on your own in your fight. An interpreter in your results to decode. I hope I will see you guys in the next video. Thank you very much. 13. Custom functions: Hey, guys, make a let's go here. Thank you very much for joining an under video inviting for beginner scores. And in this video, we're gonna talk about functions in previous video, recovered the lists, the conditions and now we gonna talk about functions. Let's dive right into the hands on part in visual studio gold. So having individuals to the ago let's prosecute the terminal, the hem in the hands on file. We going to define our first function. Now. During our previous videos, I covered couple off example functions in case of police. When we had the sword function or reverse functions, each of these was a function. But in the fight, and you can specify your own function defined the function. So the function consists off three main parts the declaration but the definition part with the death keyboard starting now, you need to specify a name and the name function name of the function can be the same. Its name off the variable. So using the letters numbers, the underscore showed the right way to define the name. And the good convention is to use the camel case, which I mentioned in previous video. So the words are separated with the underscore every time, starting with lower character. So let's go by defining function called some do numbers. No, the function must have these round brackets. And then the double column is that the aunt now at the next part, is to define a body of function. But before we dive into function, we go talk about parameters of the function. Now, between these around break, it's you can specify the perimeters. So in this case, we want to some two numbers which we will provide us a perimeter toe a function. So let's name the perimeter swivel calling number one and number two right. And now these parameters will hold values within the body off a function. And when we want to define the body of a function, we again need a tow indent the fight on cold using the force bases or the topside. So the body of the function the definition of the body, is the same as in case of condition. So if you see a visual studio code automatically is putting the indentation here for you when you have set it up here in the right bottom corner. So if you click here you go. Intend using spaces and and you're good. Now now we're gonna define the body of the function. Now, within the function, you can specify the variables which will be Onley in the function. So in this case, we want to have a variable total which will consist off the some off two parameters off the function. No, please remember that you can use these total Onley waiting the function body. Right? So now we have the second necessary part of the body of the function. And then we can define a return value off function. So after the function is being called and executed, sound value needs to be returned. And in this case, we want to return the total right now Notice the difference. Imagine so right. So right now I have defined a function with the total variable inside. If I would have total variable somewhere else like thes these total. It's not the same as the total within the function. So everything defined within the scope off the function is something girls as the same variable defined outside of the function. Right? So you now in the function I'm overriding the total outside off the function now, having the function ready, we can call the function and the call of the function is a simple as some two numbers. And here we specified the values for the parameters off the function. So I want to some to end too. It's good toe put space between the parameters. And now having these, we will run the Python interpreter down here by writing by three and pressing enter. And now we can highlight the function which we want to run and also the comment. So as you can see first, the definition has been executed. But nothing was. Bring it out when you defined a function and around the definition nothing is printed out. You're only saying toe to heighten that for these name. Whenever you see these name, please run it as a function with two parameters and fight on now knows that it be around some off two numbers, right? So as you can see, this is how it works, right? So fairly easy. Not now. I will now cover some example simple examples of functions. But feel free to right now your own function. Please pause the video and write the same function, for example, for some off three numbers, right? What will you need to change in order to some three numbers which will provide this perimeters? Now let's go into the functions. That's that by where you can see examples or function. So here in the comments section, I provided some brief description of the functions, which is the name what is they put? What is now? This is exactly the same addition function, which I did. You can change the name of parameters and the way you want. But yes, some descriptive names should be better than a and B aside in this case now, not is one thing. So I will around these definition in the vital interpreter to be able to use it. Please. As you can see, if there are three dots in your fight, an interpreter click inside and press enter because the fighting interpreter doesn't know you stopped definition and he's expecting another definition. So please just terminated by pressing Enter now, Having these addition, we not only can do this, which is nine, but we can also some use the operator for strings, so use the plus operator for things in this case, These will come, Captain. +82 strings together. So what? He'll be up pulled off these? Well, if you thought there will be a space, there won't be any space and it will be mining without the space. So as you can see that this one off the differences between other programming language and fight and programming language. So Beytin doesn't expect you to define that type off the perimeter. In some languages, you have to specify the type of the parameter. For example, you are creating addition Onley, foreign teachers or addition only four strings and you are not allowed to put anything inside. Now, fightin provides you the opportunity to put anything inside us. A perimeter, a string number of very sorry. Least everything would you want? Even the function can be a perimeter off a function. I will call, read in later tutorials. But right now, feel free to test this example with the stinks. No. What if you want to compute three numbers right? As I said, the one way is to create a new function with three parameters. The thing you should drive, but you can also change the output. So if you look at this cold Here we will start in the middle. In the middle, we have five plus four, which is nine. And now the output function. The return value is the result off these addition will be provided as an input for another audition. So running these is running these equations exactly. So if you ran these, you will see the addition off five Loose four plus three these way. Is it? We can rewrite this way as to nine. So having it like this is exactly the same as this, right? So you can change the function output as an input toe. Another function. You can do it any time in any function you want. Now we can do these the same for forest things. So now first I'm auditioning the medical proof hood school. Then I'm auditioning the output off me Help Osasco and is then the same for the and then the same for best. And together it will create a while. Big string without spaces make a whole school is the best. Very simple, right? No. Imagine you want toe create the function which will concatenation two strings and put a day limiter being between them. So we want to contaminate two strings and put millimeter off off space. So the single sink simple definition is like this. You create the function with three parameters and you can just immediately return string one plus the Della meter plus tearing through because we want to put the limiter in the middle. As you can see, you don't need a temporal value. Variable results for for the result and then return the result of the operation. You can immediately put the operation in the return statement as thes. This will be automatically computed for you. So if I have a function like this and running and ran it with so I want to bring make our whole school and Della meter off comma. So I didn't run these. Now you need to press enter and now I want to run Michael Holtz Couples comma. I will get the result Mikel comma Good school. I hope these to understand. It's it's quite simple now. The order in which you specify the perimeters is important when you don't specify the name off the parameters, you can change the order if you if you ran the function by specifying the name of the apartment, for example, you can run exactly the same thing about just with the space by saying strength. Additionally, millimeter And now, police said in the limiter to this set the string to this, said the string, Want this? And in this case, we can change the order of the perimeters. This is quite useful in some cases, and now when you are calling the function like these, everybody who is reading your coat immediately knows what is the value would score being referred to, And what is the Value Me car being referred? So it's quite easy for a cold for the others to read your cold fire and these I get me hold school now. Buyten's provides you the way to specify something which is called optional parameters. The optional parameters are the parameters which you can, but you don't have to specify. For example, let's rewrite our string addition with millimetre into something like this. And as you can see, the only difference between all the definition and the new definition that we said that the Dell emitter is optional with the default value off space. So now whenever you will call the function, we doubt the third parameter, it will be automatically replaced with optional value. So if I ran the definition pressing, enter and now if I around the coat, it will around Michael Holtz cope with the space output. Me couples come in space now, but the optional parameters can be specified if you specify another deli meter. So the third positional argument it will override the optional parameter. And it will ride this common in this case fairly simple. Tried in Europe? No, let's say we want to to create a function to some numbers in an air raid. So let's recap. There is a function called range, and again you can see that the range is a building function. So somewhere there is a definition off the range function. These are the brackets for calling the function, and this is the perimeter off the function. So we created the least off off numbers, starting from zero and finishing from 6226 evaluated by running this and now we want to create a function called some list which will get at least as an input valuable with numbers, and we want to some we want to get the total off the some off the numbers, reading the list. So we create a temporal over a biblical total, set it to zero, and then we ran in the cycle through the numbers, and we add each number toe the total, and after the end off the function, we just returned the total. Feel free to pause the video and check out the code. We are just iterating through the list. Now let's try to run these functions of first round definition shift, enter clicking the interpreter and press enter because the three dots are there and now around the sample east with the numbers which we run in the previous command. Now, as you can see, the result off the salmon list for numbers is 21 so you can evaluate this result by running the building function some, which should output the same result. So highlighting the some shift enter 21. No, you can also use the functions into if statement the results off the function in the condition off. The if statement, let me give you a simple example. Imagine having a simple sound function like this. It receives two parameters A and B, and it returns the summer off a plus B Now highlighting these, we can execute the definition of the function again, pressing entering the interpreter. And now we can define a simple function. If simple, some for three is greater than simple. Some five to first is bigger. And in the other case, second is bigger. Now, Uh, as you can see the output off the function, the return value will be immediately placed in the if conditional function. If if the if condition. Now, let's get the output. Because these two guys are the same, some, the else statement will be. Well, put it. I can click here. Press enter. Second is bigger now at the end, I want to show you and called for you more complex example. So imagine having assignment like this, given at least off numbers. Britain, at least containing lists off, ranges from that numbers. Elements incriminate or should be specified parameter. They felt toe one red. So imaging you have a function coldly strangers, which will received array off numbers and then income and value, and it will return. At least off lists were the least in the least. We'll start from one up to the element value. So it will be 123 because this is three and 1234 Because this is for now, Let's go toe a hands on and do it for for you. I will do it for you. So Death least off ranges. And in this case, the two parameters are number, list and increment. Specify the number least and incriminate which will default to one. Now we want to create the list. So result list, we will first create the valuable which will hold the result off the function. We will set it toe empty, leased And now we will go for number, number least and for each off the number we will create a least starting from one upto the number and we can do it like this. We will create another variable first. So then pour out least which will consist off the least a range starting from zero up to the number which we are now iterating through. And we will increment it by the increments. Yeah, and now at the end, the only thing what we need to do is we need toe up, end this list to dress up list. So result least upend. Then put all waste now. And don't forget that at the end of the function, we need to re tour return list. Now, having is ready, we can run the function as it wasin the assignment. First, highlight the function and around the definition press answering the interpreter and now around the cold. Yeah, and as you can see, I made the one mistake in the assignment I had. The numbers should start from one I my numbers start from zero. So what should I change exactly? I should change this number one. Now if I ran it one more time again, you because I changed the function. I need to rerun the definition of the function. And now I can run the cold, big a camp. So as you can see, I got the output and I got the numbers back to the definition. You can see that I want toe end with number. So basically, if I have three, I should have at the end three. But I have only two because, as I mentioned, range has opening trouble at the end. For this reason, I can adhere. Plus one you can see even I make mistakes and it's it's it's normal. You're learning with your mistakes. And sometimes the definition is so complex that the step by step approach is much better than putting everything in one place. Now everything is perfect. If I change the incremental to to the numbers will increment by two right now. What will happen if I didn't specify a return statement? As I said, the return statement is optional. And in the de felt, the function will return a non object non in Beytin stands for nothing. So if I didn't specify the written value the computation again You have tow highlight everything in run it breast center. So if I don't specified written value, the competition will happen behind the scenes. But nothing will be returned from the function. Yes, you can see I don't see the non because no is not done. Put it. But if I do it like this, no one will be up. Right. So the non is the default return value. All right, guys, that was some basics in the functions. We will do a lot of functions during future tutorials and videos. So please take your time to go into this topic. I'm glad you were with me today. I hope I see you again. Next video. Bye bye. 14. Tuples: Hey, guys, Mika hopes. Come here. Welcome to another video you know are fighting for beginners tutorial. And in these in a session, we're going to talk about doubles. Now I have load off friends in the programming with Biden, and some of them are never using the doubles in their own cold. Yes, if we will be only writing the goat, there won't be any, you know, point to learn how to use staples, but sometimes you're using code of someone else. And there is a high probability that this guy may use temples in his coat. So in order to understand temples, we will have this video. So let's going to the resource to decode. And you can think about couples us lists. So I will jump right into the hands on that pie. So as you can see, I'm already running the beytin interpreter and in order to define the total, you can't you have to do it like this. So let's let's give it a nice variable name like number double equals two 123 And this is double. So basically the only difference between the couple and least you've seen the brackets. So instead of the script records. We are using round brackets, and you can immediately bring the type off the variable number tackle to see that the biter has recognized a new data type. So as you can see a class staple, So what are topples good for now? The main difference between the chapel, at least, is the couples are immutable now. Regard the other video where I was talking about the mutability inevitability and and least are mutable. What does it mean? So you cannot change something in the temple? You cannot do something like this. Number couple of zero. So let's say so. So this will return the first element of the couples. So the syntax for accessing the elements is exactly the same as in case of a raise. But you cannot set these two. Let's say seven, right? So for Randy's, I got type air or chapel. Object does not support item assignment now. This can be crucial in some situations, which we will cover in future videos. But right now you have to keep in mind. The chapels are immutable. No, with Apple's, there is one. There are a couple off syntax issues which we will covering examples. Now let's go to the file what we have here. So I was talking about the fact that you cannot assign a value toe a chapel because to existing chapel, because topless anymore. So let's talk about constructing a couple. There is one more way how you can construct the double just basically by skipping the parentheses. If I ran the command something like this immediately out of nowhere, I will get the topless result. Now the question is, how do we specify a single element? Apple. Now, this can be very tricky in python. Well, for example, after everything I said right now, some of you may say, Well, that's easy. You just go and and you go like this great. But that's not true. If you run these, you see, you get just the well. So you are not getting the top. Listen up. So in order to read on a single, I made up a couple you need toe. Add a coma at the end off the numbers within the single Lamentable. Now this is a temple, and it's just the single time. And so if you run like the first element off the staple is one and the last element off these deputies. Well, so I'm I'm doing the syntax for you, the special syntax in one line to learn new ways. How you can write stuff. So so you can just check out these and try the syntax in your interpreter to get family or with the syntax when you will in the future, seeding someone's coat. Now let's go back to Chappelle's and why are doubles useful? For example, if you have a function like this, so function returning chapel when you want to return one more than one return value. So, for example, this function returns to elements. So we were talking about about functioning previous video, and I showed you how you can try the functions, which which is returning only one body old one value. But you can return as much value as you want. So, for example, when you have the function like these defined, so let's front the definition and when you run when you call a function like this with one and two as the arguments, you will get well. First, these are three dots you need to run entering the interpreter so when you will when you will execute it like this, you will get a new element chapel of these elements. Now if you go and put their another element, there can be 34 It's up to you when this can be very useful now why you can directly assigned the report value off this function toe two variables. So, for example, having this function over there, I have rewritten it. Here. You can directly assign the return value to two separate variables. So this is a valid syntax in fightin. Now, after running is my question to you is what is the value off variable E. One. Yet it's one and eat, too. Yet it's too. Now. What will happen if I specify only one variable? You can see the one is the whole chapel now, so this is crucial. So if if a function is returning to values, if you return a couple, if you assign it to a one variable. But if we ascended to multiple value, very boast to, we will get immediately values. It's called unpack. So we're unpacking the chapel values directly into the variables. Now what will happen if I put here? Let's say one more variable After running these, I get the value error, not enough values toe back. So whenever you see somewhere on a board on back, it means that it has something to do with return values, off function or with the doubles. You know, Let's go. Next. We have these no brain syntax, which I specified previously. So in order to specify a single lamentable, you need to put the come on. There we did it. And now Sam Bonos Teplice. So So this is a sneak chapel, right? So previously I showed you can define the top like this 123 And you can also define in the Wana element couple like this so one comma. And so based on these two facts, you can also define the single I'm in Temple like this. So this is a very sneaky couple. So be aware of it now when I have something like this, it's ah, it's a couple off strengths. So So elements in the chapel can be whatever type you want. Yes, and and having the staple. Now this is interesting. So imagine how you have the stubble which I printed with four strings. Eso Mitchell Hooke car which is my name is amazing, right? And now you want toe on back. The steps go directly to four variable. So the same exercises with before with the function goal, it couldn't be done. Also be divided able. So you variably stuff. You can unpack idiotically to a valuables. Now, when I ran these commands, each off the valuable will help separate strength. Now there is also won the special syntax. For example, we have the staples, so the same applies before Let me just printed 41 more time. And now we are only interested in name and surname. So we don't have time to think about the variable names for the rest of the temple elements . So we can specify these underscores. And that means that we will just just skip the rest off the temple and put it somewhere into oblivion. So no interested. So after any of these we have, you can see we have the name and surname store. Well, so in this video I showed you something about apples. I talk about return types off functions when we want to return multiple values. I talk about the mutability of temples. I hope you learn something new, guys. And don't worry. The practical part is coming in next video. So stay tuned for the next video. I hope I will see you in the next video. Have a nice day. 15. Dictionaries: Hey, guys, make a hooker here and very welcome back to the tutorial for bite on. Beginners will recover some bite and basics. So in previous videos we talk about that a types mathematical operations string operations we call realists recovered functions. We covered the loops, conditions. We also talk about the topples, and now is the right time to talk about the dictionaries. Now dictionary is another data type for storing multiple values, so let's just dive into the examples in the fightin in the resource to the occult. So opening the hands on pilots define our first couple again. We need to make up some descriptive name for valuable. So let's call it the Ages dictionary where well, well, very well set up our first dictionary ever. Now the dictionary is specified with these curly break briquettes. Now we had the square brackets for For the lists. We have the round break. It's for couples, and curly brackets are for the dictionaries. Now dictionary is referred to as a key value of storage, so the elements off the dictionary are consisting off keys and values. Now every G must be in off immutable type, right? So, for example, strength or couple or something like this, and the key can also be consisting off some reserve keyboards. I will show you examples. Now. The value part can be whatever we want in the dictionary. Value Part can also be another dictionary so we can create the nest, the dictionaries. So right now, let's define our First Ages dictionary by specifying the names and the corresponding gauges . So let's start with my name Me help and with my age 24. Let's add one more guy. Let's say 50 and the age off 33 right? So this is our first dictionary Now when we bring the type off the ages valuable. So let's first define the dictionary. And now around the dictionary, we can see that the class is a dictionary. No dictionaries are quite different compared to the least and chapels, with many with the way how we can access the elements. But before I show you the access to elements, let's jump into more complicated example of the dictionary. I prepared some in the dictionary that by file, which you can file in, get fined in the get help repository in the description below. So let's create these mixed dictionary and as you couldn't see ex accept the Mikel and fairly better, we have also added some other elements. For example, these element has the key off zero which is in danger and the value off zero, which is a streak so you can mix the types off the keys and also off the values. So this is everything you can see here in this dictionary is 100% value. So besides the strings, the teachers, you can also specify a bull in a seki and now this can be very confusing. So please don't do it. Mostly try to think about something different. But when there is no way you have to specify like this. So these element has the key off value true and the value off value through as a string. The same for Paul's, where the key is the false while the value is true and you can also use the reserve keyword like this int. Now, if you Randi's and you ran mix dick, you can see there is absolutely no problem for out putting this and this is this is fine because, as you can see, these int was replaced with this class in in case of fighting because Patton is internally translating these air self keyword into these value. So beware of using aggressive keywords in your dictionaries. Now, how do we access elements in the chapel and you can access the values to the keys? So, for example, if you want to get my age, you are calling the mixed dicked while specifying the key in the round. Break it up, sort in the square brackets so but beware you beware numbers. So, for example, I specify the key off zero. And when I call a mixed dictionary type with the square brackets and zero inside it, I refer to key, not toe the position. You cannot refer to a position off the element within the dictionary with the number in the in the square brackets for dictionary. So beware the biggest difference between lists and the dictionaries. We cannot refer to a position in addiction now, the same for the true and foreign. Everything from this is working. Feel free to try in your fight an interpreter. No, there is a problem if you are trying the access to access the key which doesn't exist. So, for example, Let's access the John in the mixed dictionary, and as you can see, this will cause a key error. Now the key error is one of the common mistakes in fightin programming, and you will meet it met. We did meet with it anywhere. The key error means you are trying toe access, an element by key, which doesn't exist in the given dictionary. So exactly as in this case, the junkie is nowhere in the mixed dictionary. So I will comment it out for you so and we can continue. You can easily at new key values into the dictionary as simple as this. So let's say we want their job. So you call the dictionary, you write the dictionary name. You describe briquettes at the new key and at the new value inside there, you can also adjust existing keys by, let's say, changing the fellow value from 30 to up to 33. Yes, so fairly pays. Getting older now. You can also output the mix dictionary like this, Randi's you can see John has been a bit, and the felt value has been adjusted toe. 33. You can also Della Key simply by calling Dell mixed dictionary square brackets and name off the key. Want to do it? No, you can put a dictionary interdiction areas I mentioned. So let's jump into the example off next the dictionary. So here we have some complicated dictionary which specifies a person Me. So the name is me? How surname is hope School languages is the least now careful list off strings which refers to languages which I like now my instagram Now my address. This is not my real address. So don't try to contact me City, New York Street and Street number. So as you can see, the address key refers to a value off another dictionary. And now how can we access these elements? Imagine you want to know my last my least favorite language from the favorite languages. So you goto person, which refers to the name off the dictionary. Now you go to a specific E in this case, the languages and you want to get the last one. So now you are accessing the least, which means you need to use the positional index For these reasons. The miners one is working and now the person, for example, if you want to know the street where I live Now you go to person. This is the dictionary. You retrieve the value off the others which is another dictionary and the new again retrieve the value off the key street within the key address in the person dictionary. Now, this can be quite confusing, but it makes sense because there is a lot of information new information for you. So feel free to stop the video, create the dictionary with your data. Now you can. You have to be careful while specifying the dictionary because after each key there must be a comma. So basically the same practice has been used in in a list. So don't forget the common when you don't put their the comma, the fight on interpreter Villa returning There's for example when you ran it like this. Enter. So yeah, I didn't delete anything. So when you ran it like this you see syntax error, right? So they'll do it. No, let's go. Next I mentioned that the key value Well, this is a tricky one. The keys in the dictionary can be all immutable objects, right? While the truth is that that can be all hash about objects, but we didn't call about hashing, so let's just stay with the immutable objects. In the previous video, I mentioned that the chapels are the immutable object. It makes them 100% valid key in the dictionary, which means you can create a dictionary like this by specifying the key as a chapel. Now you can retrieve the key by calling. Retrieve the value by calling the name of the dictionary and the name of the key as this. So this we will first round the definition and now we can retrieve the value with this. Amazing. Now let's go to some dictionary operations again. I specify the same dictionary. I will run it and you can call Alanna, which returns the length off the dictionary in this case, the number off keys which are in the dictionary. You can also retrieve value by specifying the key in the function called Get so this is exactly the same as if you will call the name of the dictionary with square brackets, but with the difference that these will not raise any error. So, for example, if I around these indirect in Macau, but if I want toe retriever John Key, which is no there. It won't return anything. So the return time is non but no exception. Error has been reason so, but the biggest advantage off these is that you can specify default return value. So, for example, we want to retrieve known existing key from the person dictionary. And if the non existing he doesn't re sites in the dictionary, we want to return police. No, and these can be many times helpful. And it's used through all the frameworks which we will use. So please keep this in mind that there is a default return value for right on value for returning the values off Dictionary key. Now, when you call items upon a dictionary, this burrito unleased off doubles with the key values within the dictionary. So, as you can see, this is a list. Yes, it starts. He thinks that doesn't matter. You can. You can even put it like this to make it more readable. So converted to least. And as you can see, these whole thing is the list. And the first item is the key name and the value me how in a couple and so on. And so the interesting is the address one. So this whole thing is a couple with the first item being the others and the second I 10 being the another dictionary. Now, having these items function makes it easy to Travers through the whole dictionary in the function. Now, you can go in the fourth cycle, going through all the keys and values and through the each iteration you will on back. You remember I'm backing from the last video. Now we're using it. So in the first iteration, we are unpacking the value off chapel into key and value. And then we are bringing it out, and we are doing it for each of the element now. And this can be helpful in these four cycles. If I ran these four cycle, you will see that it will return key name, stuff volume blah, blah, blah, blah, blah. At the end, address is the key, and the value is the whole dictionary. So keep in mind Travers Inc. Through the dictionary Billary on the chapel's, which can be unpacked into the variables in the four cycle. Now we have also the keys function, which really don't the keys off the dictionary. So again. The key is you can convert it into list the same for values. Now there is a pope function which will return the item. So, for example, if I ran the name if you return the hell because that isn't the name from dictionary the value from dictionary. But right now, it also deleted the key from the dictionary. So there is no more McCown inside there. You can also put the whole item which will return the item from the end with the whole asshole couple. You can assign it to variables again. In this case, it was deleted at the end of the dictionary. Fairly simple. Okay, guys, these were the dictionaries. Hope you learned something new. I showed you how to specify a dictionary. Some functions with addiction or use cases with dictionary. We will use the dictionaries through the rest of our courses. Thank you very much for joining this video. I hope I see you guys in the next one 16. Nested lists loops: Hey, guys, welcome back. Makeup would come here, and in this video, we're gonna dog about nested loops and less lists. Thank you very much for joining the to the fighting tutorial for beginners. And let's start with the visual studio code. So as I mentioned, elements off the lists can be almost everything, so you can have also lists in list. I showed some simple examples in the previous video, but let's cover something deeper. Besides nesting lists, you can also nice troops. So, for example, you can have four cycle in another four cycle or wife sat wild cycle in while cycle. So the thing which we want to do right now, I'm gonna show you how to solve some simple examples using nested loops. And then we will go to another examples off Mr Lists and also off lists of strings. So let's start with these example. Imagine a tasks to write a function called display butter that will, based on the input number, all put the following pattern. Yeah, so, for example, having the number, let's say four de system for the button, we look like this. It will have four rows in the first throw we will have four stars in the second row. We will have three stars on, then in the third and the fourth will be to win one start. Right. And we will call the button like this. Okay, so So I will code it for you step by step. So the intuition is right now. As you can see, we are decreasing numbers, starting from four up to zero. So it's It's fairly easy that we will need a four loop which will go to arrange starting with the higher number, and we'll decrease up to one. Right. But before we do that, let's define function. So death and the name of the function should be displayed pattern. So these play Dr and we will have ah, valuable cold number of rows in this case number, rose or rose number to make it more correct breath. And now we will go in the four Loop four and we are retreating to through the rose. Right, So let's go for row in, and then we need to create the range range starting room from the from the greatest numbers to the rule number, uh, up to let's we need to send at at one, but the range is open interval. So we need to put here zero and we will decrease the number. So let's just start with these simple things which we did. It's always a good idea to bring out the intermediate results, to see whether you are on the right track to solve the problem. So let's let's stick with the definition around the definition off course. If you won't run it in the resource to the code, you need to open the fightin, then highlight the cold and shift enter in the enter because three dots are still here and now we want to call it. So this play pattern and let's say four. And when we ran it, we got the numbers, right, So we are on the right track. But now what? What can we do? Huh? How to transfer these numbers into stars, right? There are a couple of solutions for this problem. But right now I want to show you the four in four solution. So having a nested loops to solve this problem. So how should we achieved the the right number of stars in vitro? So we go for and no four star. Let's call it star because we are going to output the star in range. And now we are creating the range for each row, starting from zero up to four. Yeah, it doesn't matter. We just need to repeat it that many times. But this is this is a nice way to do it like these and up. What is the upper boundary in this case? So if you look, we need to put the upper boundary the current number. So because when we printed the road, that was the number we we will use the road also here now. And while we have these, we want to print for each alteration in the cycle. Off start, Rick. But do you know was the problem here? The problem here is that trained will always output the strength in the print into new line . And in order to prevent this right, you need to put an and parameter at the end. Now the end perimeter, as you can see, is the optional value. Yes, as you can see also hearing definitions. It's optional value, and it specifies the day limiter. Well, the ending off the street so out of the box. It's set to new line, but we can set it. You can see it here. It's here and equals new line. So that's the definition off it, so you can override it by providing any other strength. So right now, we don't want anything after to be printed after the star, so you can specify just like this. But what will this do? Let's see. So if I ran the definition again because I changed the function, I need toe re around the definition. And then when I mirandes, we will have just multiple stars in one line. And that's because we override over than the ending the ending. So now we need for each line to book the new line by ourselves. So how do we achieve this? And we can achieve this after each row so you can imagine each cycle off the ultra loop is Roe and each inner cycle off the second look is a star. But we want to put the new line after the stars. So we need to put the print here, and when you put the print like this, it will output a new line. I hope so. Right, so so and now everything which is indented in in this way belongs to the body off the first cycle. Yes, stop it and and think about it. Everything is the is the one lines. Every gold in these intonation is one line. Now, if I ran it again around the definition and when I up with these, yeah, I didn't press the enter after the definition enter. And if I ran these I get exactly the button, which I want, right? So that was fairly easy. Let's let's try double for a number, let's say with eight. And as you can see, the pattern is still good for any number you specified. Of course, Please don't specify the negative number, but you got the point. So let's go next. Well, here is the cold. Also in these. As you can see, you can also put here empty string. It will up to the new line except you would you put there. Now let's say we have this nested least. Okay, so we have this list and we want to print the whole list to output the whole list into into the output show. Let's ran first definition of the list and now you can access the least elements, just like thesis. We do think the last video. So that's Feliz. So these refers to a second line second element because everything is indexed from zero also in the nested loops. Now, to bring it, we can have used these four cycles. So we are going for each row in the nest. At least now in each iteration, the road will help the whole least right, And this is the reason why we can deter it to grow in the 2nd 4 cycle. And then we can just output the element again. We are putting the spaces in between each other, and we are printing the new line after each row. So if I ran it, you can see that I operated the nest. At least that's perfect. Now let's let's think about something, something different. So imagine we have these, uh, nested loop and we want to first find the size off the largest throw, right? So that's quite that's quite challenging right now. How do we do that? So in order to do that, we need toe eatery through each line, Then we have to check the length off the line and then we have to somehow remember the last longest row in order to compare it so you can see we can divide it by 33 steps. First, bring the length for a TRO. So how to do it? I'm gonna show you. So let's first grab the next least and four row in nested least we want to bring the length off each row. So this guy over here real drink the length for a TRO. So first is 3 to 41 now in the so the second soup task should be Find the Max link. Well, how can you find the Max link? So in order to do this, we need to Italy through the rows and remember the previous Max link and compare it with the current pro. So the first said we will create a valuable which will consist off the length off the actual maximum in the current time. So before we ran the cycle, if we will set it to zero and now we will go to each row. If her length off the current row is greater than marks, we gonna set the max to length row and after this, we can print the mucks. Sure, max length is marks and now amazing by Randy's, you can see that Max Link is for yes, because this is the light now. So having an intermediate like variable very store, some intermediate results can help us in solving more complex problems now. But the thing was like find the size off the longest throw and bring the row right. So now we don't only want to know the size, but we also want to know the content off the longest throw. So how to do it? We can create a variable called memory where we will store the intermediate Max row. So first study to emptier because we know in these variables will store the areas so the least. So now we are going through it. And if the current road is longer than Max, we will not only set back Max to length off the current row, we will also said the memory to the current row. And now we can say at the end, max length east and the items are memory. Now. When we ran these, we got also the items off the longest throw from the nested list. Pause the video, go through this coat and try to calm yourself, for example, at the way how you can find the shortest row and the elements off the shortest road. Yeah, you can make it more challenging. Try to do a list in least in list and you can try to find out. Longest throw in the in the third level off. Blessed Fine. I want to also show you something which is called Enumerated Function. For example, you have these least off strings which consists off names of different names of my friends , and now you want you will create something which is called and enumerated. So, for example, first of all, let's look at these. This is how look at least and when you put it into a non enumerated function and put it into list function because memory returns and intermarry. Doctor, you need to convert it to list. It will create a list off couples where the first element is the index off the name. And now this can help us like, for example, we want to find the longest. Yeah, the longest name in the in the area in the list. So and we want to find the index off it. Not so, not just the size. No, just the content, but also the index. Okay, so So I copy pasted the same function from the last time. And this time we applied it to names. But we are iterating through an enumerated object. So because these are couples I showed you we can unpack The chapel's into variables. So for each cycle it aeration off the cycle. We will not only have the name, but we will also have the index off the name. So the four cycle goes like this for the given row or for the given name on the index and the value is the length off the name Greater than Max. If it's a first iteration, it will be police. Set the max to the length off the name, put the name into memory and we are now. We need also memory for the index off the name and put in the memory index the index off the name. Okay, so for the each part before the each cycle, we have the zero and he said, do nothing. So we are saying is the length off the Mikel greater than zero. Yes, it is. Then please said the length toe length off the vehicle put the memory putting to memory the name of the become people. Because I was greater than Max and put the index member index into memory index. Right? And at the end, just print out. Longest name Is Catherine having the length off? Eight and indexes three? Yes, it's three because we are indexing from zero. Fine. Feel free to go through these examples. Take your time. Try to run it on your own. I hope you learned something new today. I was trying to choose some interesting examples with the practical usage which we can use in the project and also in the further videos. Okay, guys, these were the nested least and the nested four cycles. They are used quite often. So please take your time to get family related. And I hope I see you guys in the next video. Thank you very much. 17. Exceptions: Hey, guys, make a good to go here and welcome to another video in our fighting for beginners tutorial In this video, we're going to try to talk about biting exceptions and help to handle them in the previous video Recover Ness that Looked and all the other fun stuff. So please check out the previous videos. If you are not family with the topic, let's dive right into the hands own part off the visuals to the court. Now what are exceptions? So let's start with a simple function where we want to divide two numbers so deft division and we want to divide numbers A and B and we gonna go for result equals a divided by B and after dead, we going to return the result, right? So what's the problem with this? So having a simple division like for and to cause nothing, we can run the definition of the function. Yeah, don't forget around the bite and three in the terminal before, so we're on the definition of the function without any problem. Press enter and then the division will auto. Two. Amazing Everything is working correctly. No problems. But the problems arise when they try to divide by zero, and these can sometimes happen now. When we were trying to divide four by zero, we get zero division error, and these will interrupt our program and can cause a lot of trouble in the production environment. Now, when I will talk about the production environment, I mean the environment where you cannot make fast adjustments. For example, you are developing a cold, and you want to try to sell it to somebody. You will sell the code, and after that, the coat is running in the production environments. The customers are running the coat, and when the error will occur in the production environment, it will break your whole cold, your whole application and the customers may get angry Now how we can solve this, how to solve exceptions or arrows in the fighting Now fightin provides us the way to handle something, which is called exceptions. So whenever an error cool the fight and raising exception now and we can try to catch these exceptions so literally in the fighters were catching exceptions. No, how we can do that, let's go into division and cover the cold where we are making the division because, basically, as you can see, there's exactly so so previously The Cocos like this right and vital is saying us that in the line to there is a problem with the division. So in the line to your dividing it, yes, and then it's propagating tow line one because it's saying well on the line to you have the definition of the division and inside the definition online to there is happening the exception. So, like the fighting is propagating the error upto the root cause of it. No, uh, how can we How can we solve these? So let's just cover our division into try except syntax so dry except and now everything. Would this in the tri bite on will look for the exception defined in the accept part. So right now we want to get the zero division error and we can we can name this Well, let's let's just put it like this and I will explain later. So now whenever a zero division a roar happens within the try block the exact block will do something so them we will trained to our user. Please, Police don't divide by zero, right? So now we get around the definition, press the enter and when I run the function again, I can see that there is some error cold. I'm bound local air, our local variable result. So what? What is happening right now? So let me explain to you Beytin will first try toe assign the result toe division off a slash b A divided by B. The problem is that these division is causing an error. So is throwing an exception and these costs that the result will be not assigned it. All right. There won't be any value because this is returning error Now the error is caught by the except course and then it's printing out. Please don't divide by zero. We have it here and then on the line six as we concealing seeks, we are trying to return the result. But there was an error and as I mentioned, the division didn't happen. So there is no result in results, so there is no value in the result, right? So we cannot return in return variable result before assigning value to it. Right? And so this is exactly what is the fightin saying to us now? The right way to fix. This is to put these rhetoric statement inside the try calls. So on Lee, If that the try will result with assigning the result value Onley in this case, please return the result. And in other case, please write down Don't divide by zero. Okay, Right. So these was a treat one So now when I ran it and when I ran the division. As you can see, I will get Please don't divide by zero But when I ran for and to I will get the too. So try and accept is a clause which help us to catch the exceptions right? Which are reason because off fightin errors now. But I was talking to What is this? S e right? So in order. Well, sometimes we want to see the error message, right? Right now we didn't see their message. We just don't know. We just know that we shouldn't divide by by zero. Right? But sometimes you want to print the error message which you saw previously weed out there except and without interrupting the cold. So in this case, whenever fightin raises an exception, the exception is sketch inside these except course. And when you put here This s E the fightin will assign value off the output off the exception in tow, the variable e. And now we can print exception waas and the E red. So with these s e, you can't even skip it, and you can You don't need to use it there. But it's good practice to catch the exceptional and assign it to a valuable because that's quite a common practice. Important programming. And after assigning it to variable, we can print it to the end user. So again, around the definition, run it and you can see police don't divide by zero exception Bus division by zero. So division by zero is the exception. Right now we have the understanding off the exceptions. But besides kitchen one, because you always need to specify the type of the exception you want to catch right, I'll show you how to catch any exception. But, for example, imagine you want toe catch. Another exception. I will show you example. So let's imagine you want to run the division with A and B. Somebody accidentally ran your division called with A and B strengths, right? Then what will happen in this case we got an exception called type air or on supported operandi type division for strength and string on the Line three. The line is here, and that's the division and division is not supported for two strengths. That's basically the thing. Well, despite and saying to us in many cases you will and country exceptions, the first thing to do is call read correctly the exception and look for the root cause off the exception. Don't just be like set like it's not working and don't give up. Just read the exception carefully. Most of the time, Fighting is trying to say you the right way how to fix your problems. And it's exactly in this case also. So right now we can catch another exception by specifying another except course after that kitchen to top adding it to me. Yet now I can reuse the E because, as you can see, the variable is Onley usable in the scope and the scope is defined by the intimidation and because this is on the same place that he in this exception is not the same E. S in this exception catch or the exit. So now I can say police provide only numbers. Bring exception. Waas again, we've around the definition. Yeah, I have your syntax error. So please delete the sign which was here because in this case, it's the wrong syntax and fight on this. Just think I have run syntax around the fight. An interpreter. Execute the definition of the function and now you can run it. As you can see, police provide only numbers. Exception wasn't support to different, blah, blah, blah simple. Now let's go to another examples which I created for you in this try except file. So this is the exception which I was talking about right now. Let's go deeper. Imagine having these three functions. So first is the division, right? Second is the audition and then I have a function which is called a calculator, and this is a very special function. It tooks to arguments, first number, second number and a function. So right now, in these example, I'm passing a function as a barometer to a function right. So now we can then run the function which is being sent to the function as a perimeter with two other parameters from the function. Feel free to pause the video and check out the syntax now. And how do we call it? We can call Calculator 10 and five division. So in this case, when you're looking toe calculator function, the function valuable will be replaced with division and will be called with X and Y, and the division is divided, defined a bar, right? So when I ran, all of these definitions press enter. And when they run the code for the division, I get to when I want to run the the addition I just changed the division for addition. And this is a simple way how I can pass the function toe a function as a perimeter. But what I wanted to show you is that in the division I have a traditional exception, right, So a traditional try except statement. And as you can see, after catching the exception in this part, I'm raising the exception toe another level. What does it mean? So imagine it's not here. So I will let these guy and I will add it here like this. Right? And I will also deliver these dry catch from here just to show you the example What I want to show you so imagine it's just like this. And now I will around division with zero and now we can. Sorry, I didn't render definitions. And now when I around the division by zero, you can see that first read the trace. This is called a trace. So zero division, air or division by zero at lying to now The lines are are starting from here because when you selected the line, numbering will start for your selection, not from for the file. So it's saying the division So So let me I will just write it to another file so you can see clearly so And now I'm going around the Bytom filing terminal. But for these case, I need to greet the queen, patenting the better. Yeah, and as you can see, so division by zero. So there is a There is an error in the hands on by which is the name of the file, which I'm running online too. So there. So there was the error and then the error is propagated. Toe the hands on part line 14. And what this line 14 That's these return statement. So as you can see the because here I am calling the division, which is replaced for the variable, which I'm sending their the error will be travelers from division upto calculator. And then it will go go up to line 16 here. When the actual call happened and these were using these threes, you can find out the place where the ever happened. Now And if you look in here what I did waas that in a in that I changed the division function to this. So let's adjust the division function. So I'm trying to toe catch an error any kind off exception. So any kind of exception, this is a general exception, cause so any exception happen after getting the error. I'm I'm saying error in addition and I'm raising the exception to another level. So these exception will be sent to the place where the division is called and because we see the trace the trace saying us that here in these function that error will appear right ? So if I run it right right now, you will see that still, I have zero division. But the error in addition division by zero, was printed because I got the exception. And as you can see, vital is saying is right now. Yes. So there was an error on line three that's here because the traces in memory was then returned online. Six. That was then appeared online. Six. That's here because we raised the arrow. Then it appeared online. 18. That's here and then the pit online 20. Right? So in order to catch the error in these parts, we need to adjust the calculator function toe a function which I specified right here. Sorry. And as you can see, after calling the function, I'm catching any exception. And then I'm saying, Please fix this. I'm also adding a little vary in case off off exceptions. Exceptions can also. But the thing which I wanted to show you is that you can raise an exception from the function. Call waiting. The function. I know this can be quite complicated, but if you ran this gold, you will see that no exception is presented anymore. Everything was sketched successfully and every output was printed. Police pause the video and take your time to go through this cold. It's quite essential to see how the function calling can be chained and the accent exceptions can be propagated through the function right. So going to try exceptions to try except file. You can see also there some other interesting examples. For example, the the fight and provides us a keyboard, which is called or keyboard connected with the exceptions, which is called Finally, and let's look at this example, we have this example called example finally, and I'm catching exception Weeting these block and we think this book I'm just bringing a But I'm raising an exception, right? What does it mean when the fighting the preferable go toe this line, it will bring the A and then if you go to this plant line, if you're racing exception, which will be caught in this except block, but the return world won't be run right, so we will not return a in this case, but the B will be printed, and then the, uh, b will be returned right? And because we know how function works after things being returned, nothing else from the function will happen, but because we are using Finally, what finally does is that whenever try except block is present it the body off the finally will happen anyway, even when there is a greater in the function. So when I ran this coat again don't forget to open the beytin their brother. So when I ran this gold press enter and I execute Example Finally I will see the A because the print a is here. After that I will raise an exception Fine Then I will spring be because the exception except Block is being executed. Then I will return. But because there is a finally I've open sea Now let me show you a difference. If I delete these finally and put it on Li like this no Princey will happen, right? Why? Because we never functionary turned something. The rest of the body won't be executed Now you can ask me Well, Mikel But what is this good for I To be honest, I can say there have been just few occasions when I use the finally statement in my coat. So feel free just to keep these information as a small bonus part off the exceptions you maybe will not use it. But whenever we will end country you will recall the Mikel Vasco who was telling you how this finally part work? Okay, guys, thank you very much for watching this exception part. And I see you guys in the next video 18. Files: Hey, guys, welcome to another beytin video In this video, we're gonna talk about files in the previous video record exceptions and let's dive into the files. I will show you some examples and we supposed to do your coat. So let's be look into these bite files, that bio of files that by file we can see examples how to use Bytom to open and close files . Now, when I will talk about files, I mean any file note, just the TXT file or that by file. Okay, so feel free to experiment with any kind of file before we move on. Let's define what a file is. So each of the file consists off header data and end off a file. End of a file is a special sign or character which represents the end of the file. This helps bite on while reading the file to stop the reading after seeing the end of the Final Five sign. Now files are stored at the part and the part difference across Windows and UNIX. So in those guys, please beware that always I'm writing The path in the micro is which is a UNIX based file system so in case of Windows, please make sure you know the exact part to the file now. The next thing is that files have lines and each line according to standard can and either with two signs called carriage lettering, tone and Line feet in case off windows. Or it can just end with the lying feed in case off limits based operating systems. Now we already encountered the line feet when we had the new line side in the Prince statement. The front slash that inside is exactly the lying feet sign, which is in every file in the MECO is or or in the looks. Now, in case over windows, you will encounter science like slash and or slash slash out of slash man at the age at the end of the line. These scary light online feed combinations can many times cause troubles while moving the files from windows up to the MEC. So please be aware of this fact Now, in order to read from file, we need to open and close it and inviting when you want to open a file. There is a building function called Open, which consists off one necessary argument, which is the name of the file or the parts to the file. Now, here, when I'm calling file, render variable and I'm setting it to open that a file that 60. I'm sitting it to object off the file, which is returned by opening these files. Now the question can be okay. Talbot, where does this fiery sites? Well, whenever you ran a bite and interpreter or a pipe and coat, a vital will always rule. Look for the files within the root directory. And now the root directory in these case is the bite and folder here in the left, in the resource to the gold, where the fight and fiery sides so that a file 60 will be looked for here waiting the folder. Okay, so if I will move the files that by file into another folder and I will run it again and the data underscore file takes the wondrous sides there, these can cause troubles or can't misbehave. Okay, So beware that you always need to place the files next to your biting script. Now, whenever you open the file in the bite and you always need to close the file now, this is a very good example. In practice when you don't close the file, these will cost a lot of troubles pending open files again cause memory issues with your computer while running the biting cold. So please, always after running the open, always round the clothes on the object which is assigned to the variable. Now, I know that I didn't talk about objects too much. Just keep in mind whenever you ran an open. This will return the file object. I could show you in the next examples now, because many times people forget to close the file. One thing is highly recommended it biting. And that's the usage off something which is called Fight Manager. And wherever you will see a keyword caught with and then followed by anything. This is something which is called Manager. Now the fight and manager will around the command which is followed after the wheat and assigned the valued return value off the command to the variable, which is after s so basically these one line of code is exactly the same as this one. Now, in the bite that managers are a very powerful tool. He'll hear whatever you opened within the pint of manager with open will be closed after the indentation block off the manager. So after the body of the manager is ran, the file will be closed for you. You don't need to call the file that close. OK, so these makes are all a little bit easier and and we can concentrate on other stuff while coding. Okay, So much grantees. And you will see that after Iran these I will see. So you need to first around the fight An interpreter renew terminal. So please died down by the three. In case, of course, that I like the coat and shift Enter again. Three dots go there clicking the terminal on press enter and you can see these strange brackets on the things inside refers to an object and we can see the very something which is called text I rapper which is returned after the after we open the file. Now many of human noticed that besides one required argument, there is another optional argument which in this case, is an r So there are letter in this case dance for reading. So in these cases we are opening the data under school filed a txt Onley for reading. You can open the files also for many different activities. For example, you can open the files with W for writing. Yes. Then you can open the files with R B, which stands for reading binary. Now. Reading by Hillary is very special kind of reading, which is used mostly with picture files or another that the types now in these course I'm not covering the re binary or right binary functions or modes while reading the file. So please feel free to Google it. I will not use it during the data science courses. So if you are interested in and you can find many off, resource is at the Google now, besides a reading and writing, there is one more thing. It's called a pounding. Whenever you open the file for writing, it will river in the content of the file. But if you want just to happen, something at the end of the file police run open file with the A, which stands for a pent. I will show you examples later in this video. So now let's go back to our example and open the file colt That data underscore filed at the X t for reading and assign it toe variable off file. Now, if you look here, I have the folder structure which I'm using. And as you can see, there is the gate Have repository, which are which you can find the link in the description below. But here in the repository, you can see that there is a files that by which is the file which I have currently opened and now in the same level in the picture in the directory, you can see the data underscore file over here. Clean here, and you can see there are just numbers printed all the inch line. So this is a txt file. Feel free to open ended any other editor if you want. But Visual Studio Co is ableto open almost every file. So and you know that it's not that that by file, because it ends with 60 suffix. So let's go back to files and open this file. And as you can see on the next line, the Line 14 I'm running the common core print, which is basic print, and after dead, I'm calling a faction upon the file object, which is called the Read Line and now read line expects one optional argument, which stands for how many signs I won't read from the file. So in these case, I want to print just the first sign off the file. And if you look into the file, the first sign is number four. So if I run this command so now I'm running only for only first line and I'm reading the first time ever the file and it's four and the four has been out. Put it to the output. Now let's say we want toe around the same command, but reading in this case off two signs. Now the question for you is what will be dealt. Putting this case, I give you time. He and those of you who said that the four sign and the new line will be out put it are correct. Now why is it this? So let's just round the common first. So as you can see, the four has been output it, then the new line that the new line has been out put it and then again, the new line. Now the four has been uprooted because of the file that read Line that one and because we put it into the print print out of the box. Optionally boot automatically put a new line after the print, right? So that's the reason for the first new line after here, right? But then, because the file doesn't only consist off the visible signs, they are also invisible. Sign each off the line, as I said at the beginning, is ended with lying feet signing. Now these line feet is the new line for the print statement, and that means that the Prince statement will bring the line feet because I'm printing the second character and India is the second character is life eat and because I put life it into the print bring out of the box puts another new line after the land feet. And that is the reason why we ended that with so many you lines after before. Please take your time, pause the video and try to think about it. Yes, life eat easy at the end off the UNIX files, and now we are in the UNIX in the in the make us so unique space file system. And that is the reason why the line feed is there now what if I read 1st 4 characters and just drive around this gold on your own and try to check out a cold, I won't do it right now. No. Besides, we're reading the file one by one. The science from the file or the characters from the file. You can read everything at the same time. Now, by opening the data files that are like this and calling the function called read lines, thesis will return, as you can see, at least off lines. And as you can see, for the first line, we have four and the lying feet for the second life. We have five and land fit and so on and so on. So those are the land feeds this I mentioned last in the last examples, right? So these street line s not lead. Linus Previously return on the area off the least off off these strings. Now then you can literate in the fourth cycle through these and output it. So I added the ending. I re override the out of the box ending off Nuland for the print, and I put their empty sign not toe put everything on the new line because then I would have this formula in your line for five new a new line and so on. So in this case, everything will be out. Put it as a decent file. Amazing. Now, besides reading from the file, you can also write to the file. Now we mentioned we want to open a new data file that for writing this file. Now, I have a data file over here. I knew that I fell over here, so I will just delete it for you moved to trash. And as you can see, if the file doesn't exist, Beytin will create the new file for us. Yes. So in these example, I'm opening. He knew that a file for writing put it variable off file. And then I'm Iterating through list off strengths. And for each string, I'm writing it to a file. Now, this is fairly easy. My question to you is what will be the output. And if I ran it right, these numbers stands for the number off science within each ward. I'm writing to a file. So six is here because me Hal consists of six letters whose goal consists of violators. That's the five has two letters and so on and so on. So now, as you can see, a new data fell has been created. If you remember, I ability to file before now it's here. The question for you, What will be the content of the file and those of you who said Mika who squeeze a good teacher are correct? But there will be no spaces in this case because I didn't provide any spaces to putting into the file. Right. Feel free to try this example and try to put their spaces into the file, if you know how. Okay, No, let's imagine. We have a simple task we want. We want to open a data file and writing backwards backwards that that file Now there are two things. One thing is how toe right, a file in backwards and second, how toe rag to file, which is not that that txt file now the 2nd 1 is very easy, but we will start with the 1st 1 So first of all, you need to know one crucial thing. Whatever is defined in the pipe and manager is accessible outside off the scope off the fighting manager. What does it mean in previously when we specified some valuable in the function is what? No, it was not accessible outside of the function. But these time it is different when we open the data underscore txt that Paris file And then we assigned to a data the content off the file by using to read lines. So in this case, it will be the area. The data will be accessible outside of it, right? So be aware of the fact that the biting contacts are not the functions like the body of the biting ministries know the body of the function. And that means that the data is accessible from outside. So this is 100% while it and because we have these, we are able to use the data variable in another pipe context. So in the first fight in context, spite of measure context, you're either file and it another we will right toe file, which is called backwards, that files that by for right now, as you can see because I want to write toe a vital file, the only thing I need to change in definition off biting context in the vital manager is the suffix. So in this case? Is that five instead of 60? Amazing. Now, having data we can call the building faction called Reversed. So the reversed function in this case will rivers the order off the list. So let me just right for you, both of them. But first data. And if Iran these two commands, you will see that in the first case. Yeah. In the first case, we have the correct way. We have the correct least. And in the second case, we have again some object, right? And because reversed is returning an object in order to see the output Do need to put it to list. OK, yeah, it's the same practice. An example is with the enumerated. So the in memory objective this is the least that ever say, never saved the raper. Well, that's that's complicated. Reverse a greater object show place, put it into the list and then you can see the least is reversed in the another Worry, right? So that's why we can rewrite it backwards like this so we can run it. And, as you can see when I open to, because everything is the size of two, because in the data file there were these two, but because there was the new line feet, it is another extra character so that streaks of lights to so next. Now if I open backwards that files that by I can see it's in the river store. Amazing. Now let's go Next. The last thing I want to show you where Well, there are two things I want to show you is how you can happen to a fire. Now imagine you have the oh, you have the file which are created. It's called backwards that file that by and we want toe up end to this file to numbers, then in nine. Now how to do it? Well, it's It's quite quite simple. You go and abuse the building, open function and their number letter. A just toe happened the file and we will now appended to the end. And now we want to add their 10 and nine in the list. So reiterate through a list and assign it to a valuable number, and we can just write them. But But I think it's like this is a little bit freaky. When I ran these, what will be the exact output? What well being the backwards that underscore part filed a five. So those who said that there won't be any new lines were correct, Right? Because I didn't specify the new line. Everything is put one after another. So in order to fix this, you can, for example, do in many ways. But this is one of the ways so you cannot here, uh, line, feed, sign. So when they around these command again, I go here, as you can see. Yeah, because I'm a pending I'm adjusting the old file. So the previous 10 and 91 after another state there. So then the 10 was bringing here and Nano's here, so if I want to make it 100% correct, I really this save the file. And then I ran these enter. And if I look back here, it's 10 and nine. Correctly written at the end of the file. Amazing. I hope you understand the simple example of a pending and feel free to experiment on your own. Now, the one last thing I want to say. You you don't have to work with the files on the same level as the bite on file. These you can access uh, to the to the three directory off the file. So far off the folder where the bite and fiery sites. So, for example, imagine you have the file for folder at the same level as the bite and file is, and you want to a ride to a file to read from the file, which is in this folder. And then you can specify the way how to traverse the three. The four, the three toe get into the file. So in this case, I'm going to the file folder and opening the data files that txt and reading it. And that's basically the same example, which I did. But let me just basted It's 45321 And if I go into this file is this file So it was simple , but the thing I want to tell you, it's like, Beware the fact when you are using windows, the path the specifications off the path made a difference. For example, you can specify the absolute, but there you don't have to only to stay in the three directory of the cool and folder. You can go to the parent folder like this using two that's And then you can open a file which is in the parent directory off the folder with the actual by file decides. Right. But if you want to specify a full bath in the brain, the mako is This is a 100 valid. So from the home directory off off your machine, you go open. But beware the fact that in the in the windows is a little bit different. Okay, now, yes, I don't know too much about files and folders and maybe some of you don't know what this is . The UNIX based file system and stuff like this. Don't worry in the next videos, where we will cover some page basics and in what it will be next tutorial. And we're we will cover how to handle basic file structures in the UNIX machines, UNIX based file systems, which makes us, for example. We will cover these details. So now feel free just to understand how the open in the beytin works Now, to be honest, in most of our examples, we won't use the open file because the frameworks and libraries which will use do some kind of black magic behind the scenes with this open for us. So we don't need to worry about opening and closing the files. But I wanted to cover these topic because what is one of the essential piping skills you need to have in order to work with the files? Okay, guys, I hope you will enjoy this video, and I hope I will see you in the next one. 19. Modules: Hey, guys, welcome to another video off fightin for beginners tutorial. And in this video, we're gonna talk about biting models. I will cover custom models, third party modules and building models show Sit down, sit back, relax and enjoy the video now diving deep being to resource to the A code I have created created the new file called Operations that by where are defined to mathematical operations . Why it's called addition, which returns the addition off two numbers, and the other one is called the Division, which returns the division off two numbers. Now imagine you have a new file called Hands on that by and now you want to use addition and division and because you defined it already in the not the file. In another file, which is called also Model, you don't want to rewrite and override the definitions off the function again and again, showing these case biting provides your way. How you can import already existing functionality from another file, which is internally cold, more you So how to do it? You can easily import the whole model, So the whole operation filed by specifying it with the key word called import Now import allows you to import the operations. Now again, When you are running hands on that pie and you put the import statement inside the cold, the fightin will look for the imported operations first in its building functions. Then, if it's not presented there, it will look through the folder where the file hands on re sites. And then if it's there, it will import the operations. So hands on this year and operations are there. So it's possible to import the operations. And now, after important the operations, you can use the addition function as simple as operations, that addition. And you can put their two parameters as it wasin the definition. So, for example, four and five and by running this whole file Sorry, open the fighting interpreter. And by running this whole coat, you will see that we will get the nine s and output as addition off four and five. Now, that was fairly simple, but sometimes you don't want to pull the these operations the name off, the model, that stuff like this. So the best way how to do it is to use form from import statement so you can rewrite this code into from name off the model from which you want toe import specific operation Import addition. Now, in the right terminology, the operations is called audio and addition is called name and name is the definition specified within the model. So in this case, the name edition will be imported on Lee from the operations model. So we are able to use addition inside our cold like this. $5 for however, we are not able to use division division so toe tested. Let's run the addition issue can see it will run fine. But you cannot run the division Division four and two because the fightin will say name Division is not defined. So because we didn't import the name from the model operations, we are not able to use it. And in order to use the division within the within the code, you need to specify the name. After that division read. So now you don't need to put the moment the name off the module that the name statement into your gold. You can directly put the name by specifying from import statement by canals you also to import every name from the ma do with star but this is not recommended syntax. The problem is like by specifying the syntax. Imagine you have a big corporations file with lots of informations and models on. The problem is that sometimes biting will import a lot off stuff, and you don't know what the staff will be by providing the star here. And sometimes you can override the building functions, building names with the names from the model. For example, there will be a function called print inside the Model operations and because you know the bring building functions when I will call, when I will use the syntax and I will import a new print, the name off the building functions will be over than by a custom function from the model. So by by providing a star, I'm not sure what are all names, which I'm importing into my project. Please don't use the star function. Always name one over is named functions, which you are using one after another. That's good practice in the pipe. Now he's waas an intro off your custom models, right? How to import them out to manipulate with them, But sometimes you want to use 1/3 party motives. Now the third party modules are models on the Internet, which were called it by someone else, not by you and not by Peyton. So not the building models. Not your custom models, but models, for example, from me or from another third party. And now I will show you how you can install the model to your machine, and then you sit in your coat. Now, in order to handle now, I go back to a terminal. This is a terminal off the mag. You can also running from here by quitting danger better if you want, but that ran from terminal because it's much clear and visually acceptable for you. So now I'm in the biting basics example. I can be wherever I want, right? So, in order to handle more juice, beytin when you install the fightin fightin provides you to called people. The people tool stands for people install packages. Yes, so so the shortcut is basically nothing, but it is a manager for handling the managers or the modules from outside of the fightin. So for managing and handling third party modules, imagine you need a function which will read some file, which is gold XML or why, Mel, it's called Wyman. Yes. Eso yama file needs to be read into the dictionary in the fightin. I know you don't know what CMA am. A file. The thing is, I need to put a functionality off. Someone's called into my coat. Right, So how to do it? So, first of all, how to use a peep. You have the peep installed if you run a if you install the brightness I showed you in the first videos for Mac with the book. So if you're on people three because you you are using python three when you want to use fighting three. You also need to use pity when you want to use the people for pipe country and you run the version and you get the output like user local leap bite, and three. That's seven. You know that you are using the people for the three that seven beytin, which you are using here in the resource to the occult. Exactly. That's the one. So now when you want to eat still 1/3 party package, you can run a command called Peep three in style and the name off the library. Now, many of, you know, be like well, but I cannot remember about the library name. So how do I do that? I will show you. We go to Google, and we put there. Beep yum. Oh, installed. Right. So we are saying we are looking for beep command to install a yama package. So And if you go here, the first result is something which is called buyable that bp now the bye bye or you I be I is, uh it's a special webpage where a lot off fightin, uh, libraries are specified. And as you can see, this is a by yamma library. And is it saying, um oh, is that a serialization? Former designed for human reliability, blah blah, blah? Yes. So there is a description of this library and let's use these library in our Laura, Uh, you know, cold now, So many some of you may say OK, so I will just go here too. Hands on and import Yarmila, right? And Iran it. But the thing is like when I ran it like thes. Now I need to go to fight in either better back again. When I ran it like these, the fight and he's saying us more. You'll not found no module name. Yeah, Miller. So? So the fight, Anything male? There is no more to gamble. I cannot important. So quit from there and go to the webpage. And in the top, you can see a people command how to install a Biamila library. Right? So you can compete. You can paste it here. But don't forget to rewrite the peep toe people three Because in the Magyar using multiple pipe conversions that the number two and number three and we are using three unit Also specify the people in this case. So pick preinstalled Bayamo. And if you press enter and you will wait a couple off minutes or it should be very fast. Evil install the by, um, a library for you. So, as you can see, don't lending is done. And after that, successfully installed Biamila Version 53 that one. And now when you go to peep three and put a command called list. After that, you will see all the libraries which are installed in your beytin. Now, people is the basic library which comes with people set up tools. It's the out of the box by the library, which games with people well, is also the library which comes with people. Right. So these are the building libraries for people, right? And then you have the Byam, a library which you installed right now. And there is this version which can be sometimes very confusing. You can ask me. Well, Mikel, what is this version? How can I read it? So each a package or each model in the fightin can be specified with versions. And these three numbers stands. The first number stands for major version. The second number stands for minor version and third number stands for me Crow version. Now the major version is incriminated every time the outdoors off the package makes a big update. So the other new functions, Yes, they make something which is not so often. Right. So so Then there is the, um, minor version which is implemented in case of small updates. Yes. So So you just fixed some function, which was returning error for your users and stuff like this. And then there is the micro version, which is just referring to very small mind rabbits. You adjusted the output off something years or are you I don't know. You just slightly update the name of septic. Date of name is big change, so just small updates. Right. So whenever you download the package and you go to the webpage of the package, there is the actual stable version printed here. So five, that's three dead one. So it's good if you have your local package the same version as it a stable version of the package on the Internet. If these version is lower in the major version, you may have a problem. It's a good idea to update the library. Yes, you can update the library just just by people Install it again, or people. If you're on people uninstall name of the library and the people install it will install a new version for you. Right. So whenever the major version change changes, it's ah, it's a signal for you to update your library locally. Okay, so now we install the Biamila, and now when we go back to code, we are able to import it. Now, how do I know I should put here? Yeah, Melo, not by animal. Well, I'm using this library quite often, and if you go to the home page of the library opening your page, for example. It will. It will tell you the usage, your feet and stuff, how to use it. And so, yes. So there are also some examples. Go through the get happy if you want. It's a it's a good idea to use it or you go like Google and bring the biter Biamila use teacher stuff like this. Right? So now you can import the library by import Lamela. So if I go back to the fighting in the fire around Biamila, you can see no Eros presented. So I successfully installed Ahmadu outside of my computer from the webpage directly toe my partner. Now I highly recommend install you things from pie pie pie that work because thes are trusted things. Yes, you can installed libraries from everywhere from some get hub repositories. But please make sure you know the source off off these libraries not to install something dangerous in your computer. Okay, So, having this library, then you can use it. Yeah. Yeah. Mila has a lot off building functions which you can find here, for example, These are some of them I won't cover right now. The Obama library. The whole goal of this video was to teach you how to use your custom. Uh, ma deuce to import them. I saw the building models recovered during the rest off the videos. I showed you how toe install import Kasten functions from within your face file system. How to install third party motives from outside of your computer with the people. And I show you some basic usage off the people in your computer. Okay, guys, that was everything for today's video. Thank you very much for joining the video. I hope I will see you in the next one. 20. Standard input: Hello, guys. Welcome back to our fighting for beginners tutorial. My name is Mika Hosko, and in this video, we're gonna talk about standard input. Now, what is the standard input now? Standard input is one of the way. How can fight on interact with the user behind the computer? So through the standard input, you can put input from the keyboard up into the computer into the running fightin script. Okay, so let's dive into the visual studio, go to some examples. So for the purpose of this video, I created the file called Standard Input, which you can find in the kids up in the Lincoln description below. So feel free to open it. But I highly recommend again not to copy paste it, but just rewriting by your own, the file should be just for your worst case scenario, and you don't know how to follow up. So in this video, I'm going to show you how to use standard input with two different libraries. So in the previous video of occupied libraries and these libraries are the bite and building libraries, so you don't need to, you know, install these modules libraries outside of your computer using the peeping stellar toe. You just need to import it from your file system, running these commands. Now, whenever you want to import the library, you shoot or all. The best practice is to put it in the beginning off the file, with some exceptions, of course, but the best approach to it is if you don't know where to put it, put it in the beginning of the file. The other thing is like when you have multiple reports like this or dreaming in alphabetical order. So it's easy for somebody else to read the cold. If they are looking for the import that the top, yes, so they know that they are in alphabetical order. So let's jump right into the example back again, and I'm using model. You're library called Filing put, and then I'm using the building model sees. Well, let's start with the filing boots. I feel looking toe in the in the file. I have here common like this. So, uh, we are running a four loop and four line in file input input. We are printing the line, and what does does what this part of the code us civil. It's just bullshit disease. So if you ran the cold police running this whole and run the fighting interpreter running the common bite and three in your terminal in the resource to deal coat and then you can highlight the code which you want to run and press the shift plus enter Sure. In this case again, you have to press the enter because three dots are still there. And as you can see, nothing kits out. Put it. Not even the three equal three greater sciences. It is common for the Fightin interpreter. And what is this Now the fighting is in the moat expecting the input from the come from the keyboard in this case, right? So the thing which I'm doing, I can put here my name, for example, medical school. And when I press enter, mining was printed out. Know what happened behind the scenes? So the file input that input opens the input stream from your computer whenever the four cycles run. Right, So and because these four cycle is open for the file input, it's open endlessly will continue in the infinite loop, and it will always read your line. And whenever you press the enter the value off the line will be transmitted into the line of variable. Right? So I put the Mikel horoscope and the Mika Hosko was put inside these life and then I'm drinking it here. Now, as you can see, I'm using I'm overriding the default ending off the line which is the new line to the empty street one that why am I doing that? Because the whole line is transmitted into the line valuable. And as I press the enter also the enter is added to do the variable. Right? So let me show you if you want to. Well, because now it's it. In the fourth cycle, it's still expecting some input. And you always output the same thing you put there. And if you want to terminate this press on the make or even on the windows control, see? No, the comments, er the back by the controls control. See? Okay, Ctrl Fine. So now now let's adjust it called a little bit so you we can adhere You, uh, in food. You're your in boot is And the name off the input and we can deal with this. And so you can see there will be two line endings. So if I run it like now, right now, like this. Empress, enter. Input our the activity. Yes, you need to do it. And then you need to do off any opera cam to be able to run these. And as you can see now, when I put me foul hold score. Yes. Your input is Michael Holtz Co. And two new lines are presented. Okay, So beware the fact that these input is taking your your new line with it into the variable now, So please terminate the import around the quit and open the Fightin Interpreter again with Brighton three. And now let's go to a cease package. Now, for example, in your assignment, you will need to read from the input. Some numbers. So? So how do we create a function to read the number from the import? Yes. So we can create a function called death input number. Right? And we gonna just look here, and as you can see, when you want to input the number of with the cease units to go like cease, get the object off the cyst standard input, and then upon these, you can call the read line. Now these syntax is little bit strange. We were always used to just call a direct function upon the model. But these model Redstone, it's an object. You still don't know what's object that you can think of object as as something which is encapsulating mawr functions in the same time. Yes. So the cease, which is a library which we are importing has object inside there and we are accessing the object gold standard input and accessing the read line off it. Okay? And then we are converting it into indigenous. So everything what we read from the input will be converted into the integer. Right? So we can copy this gold. Put it into here like Okay, so in Putin, number equals sys. Studdard in and read line. Okay, Now I have the in the in my import in my valuable input number. I have the number which I put from the council and I can return it Return input number? Yeah, you can put the reading off the number outside of the function. It doesn't have to be in this function if you want. And now when you when you run the input number you can put it into X variable and print. Like the the number, Yes. And the number so x in this case. And it's a formatted string. Support the F there. Police. Okay, so now if we run this cold, you can see that the number Oh, yeah, we have to convert it. So if I ran it like this, we need to run this gold as a file. So please click correct and ran Barton in the file. And now, as you can see, it is expecting us to put the number because it's frozen. We don't see any science. So we put the for the press, enter and the number is four. We can just dysfunction. So have some descriptive like introduction, please. Brits, if I a number like this and we can run it again, please specify a number. Let's go with four. And the number is four. Okay, so So this way you can implement your old number input reader. Now, the problem with this is that you cannot put their anything besides indigenes. So if you put here for it will have a problem, right? So because invalid retrial for int base under slash and so So the problem is that there is a new line ending and it cannot be converted to integer. Okay. So you could fix this problem by specifying the try except statement from the last video and the except statement. Put some night descriptive error message like, please specify numbers only. So, in your project, you can this way called your way how to read the numbers. Yes. In the function you can have multiple numbers. For example, you don't need to do. You can have multiple number one. You could have number one, and you can then copy paste the same line in the sand string number two and then returned to numbers. I'm just telling you how you can adjust your project to make it work. Right? So feel free were to experiment with this input on. And I hope this help you to with your project to specify the input numbers for your to the A. Okay. Okay, guys, this is where the This was the input stream in the fightin. I hope you enjoyed the video. And I hope I see you guys in the next video 21. Project: Hello, guys. My name is Michael Holtz Co. A Welcome to another video of our fightem for beginners tutorial. These video is very special because we're gonna talk about your project assignment. So thank you very much for watching old videos about basic parts of the fightin. And this is the ideal time to test your knowledge and to try to code something on yourself . I can give you a little, helps how to do it. But first of all, let's talk about assignment. You confined assignment in the assignment up off the course, but also I provide you specific description of the assignment in the Give Hap page link in the description below. So let's check out the getting page if you go to the get help page. If you go to the course and click on the link for the get Happy will be redirected to this page. And this is my guitar project for this course, and if you scroll down, you can see all the examples which I covered in the future in the previous videos. But if you scroll down there, you will see a file called Project Description that MD and that's where the description of the project is if you open the project, who you will see the description now we can go through description. Okay, so the description description says Tic tac toe, create a simple detector game for two players three times in three times. Three. Great. Yes, So it's a standard tick tack toe game three times to greet two players. Nothing special. You don't need to implement the evaluation of Weiner's right because the evaluation can be quite challenging, so lets now keep it simple. Without the evaluation, the game will stop after each blood after each place of the field is taken. So after nine rounds, each game will have no grants, and the scenario is follows every round. So every alteration off the loop cycle will first introduce stakes at the beginning of each round, asking for exposition round number off the ground. So first round, second round, someone player. So the player we just on the move, so either player one or player to police pacify the exposition. Now the exposition on the exposition we mean the position integrate indexed from zero upto two because there are three times three because there's three times today's so the Max indexes to and the first thing next zero right? So that's for the exposition. Then the player will put the position from the input keyboard. So used the cease library, for example. Of course, only valid in teacher number can be specified. Then we the program will ask for the why position and then it will write to the great. If the position is taken, we will get the error message or or bring statement from the cold light position x y our. They can please specify another position. After each round, the greed will be bringing that. Now the great looks like this. So in order in, in case when there is a three position, there will be the minus sign and for the player, wonder if there will be Xs and O's. OK, you can use, for example, the dictionary for specifying the symbol for each player. Feel free experiment will do it as you want. The most important thing is to do it in cycle and check for the position. If the game is over, the fighting will bring. Game is over. Thanks for playing. Okay, so I granted the solution. I won't show you right now, I will just want toe show you how it would work. So I have. I am here in my pipe folder location and there I created the file called Buyten's a Project Solution. Where is the solution? Are you around the solutions of fighting three Project solution And as you can see, first I got the great, which is empty now around one player. Two spits a police specify exposition. I'm starting with the player so you can start with player one. If you want. It's up to you. So let's say I will write to zero and zero, right? And as you can see, the why was spring in 00 position. The field was printed. Yes, the great said the list of lists. And now the fightin asks the second the first player in the state case. Because we started with second player to specify the exposition. For example, 11 right, exactly. And these will go nine rounds and then a year they will bring about Game is over. Yes, nothing complicated, fairly simple Onley The basic stuff which were introduced in the videos. Now guys tried on yourself, and if you will stuck, please come back to this video because right now I want to give you some hints, but only if you stack. Okay. Suppose this video, try to solve the project. And if you will stack right now, I will present you some things. How to do it. Okay. So only if you stop, don't cheat. So if you stack and scroll down there, there are some Haynes. So please use these hints on Lee if you get lost during solving the project, okay? Only in this case now specify a great variable. Witnessed at least gayness. That list list of lists. If you forget about it, watch the video. Nestor lists specify a player symbols variable dictionary with player symbols. So you will have dictionary where the keys are the number of the player, right, So one or two because the keys can be in teachers and then the values will be the sign. So the value will be the string in this case, the X or all right. The next thing is create a print greet function In the previous videos create, I created a couple of functions, which will we're bringing lawlessness that lists, so feel free to use this code to create your own Bring great function. Okay, It's simple. You can do it now. Create an infinite loop while loop. So create the wild loops a while through right and in each is written here with the counter . So there will be a counter for around number. Yes. Call the counter for example round number And don't forget to increment around number after each iteration. So in the while loop iterated and increase the counter Simple Do it next And the infinite loop in case the country is greater or equal than nine Yes. Okay, So when the when the loop is at the end. So there were nine rounds so be careful with that. We do with the competent, right? So greater than nine or equal Depends whether you start from zero are you start from one. If you start from zero should be greater equal. So then you break the cycle Because that's the while. True, It will go forever So if you want to stop it you need a break Just if you forget you can recall it with the video for the loops Now in the loop create valuable player which will have the number off player for the given round. Now, this can be tricky. And there is the biggest heck. Use model operator for switching between zero and well for each round. So you can get the player number from the round number by using model and two because model is saying what is the rest after dividing, which to If you start with zero and new model zero model to zero because there is no rest If you go one model too dangerous. This one? Yes. So it will just switch between zero and 10 and one right in your own. And think about it. I don't want to give too much Hinz. I just want to, you know, give you some fun while developing in, and I want to give you these Ah ha moment when you find out the solution, right, So So just don't go for the hints on unless you you're really stuck. And then at the standard input handling for integer first for X coordinate and then for why coordinate? Okay, so then the stand that input with the in casting, which we did in the previous video for start that input report there you get the two variables and then you assign it to the great right? You can change the great with the index, the square brackets to square brackets and the index inside there. Okay. And then check in the if condition. If the position is great, is equal toe uh, minus. So, Onley, if they're in the great is minus. Only then you can, you know, change the great value. If not, then don't increment the counter off the while. Okay? And then start over again. Yes. Oh, continue. Okay. Breaking Continue now. I put their toe bonuses. So if you, for example, specify a position outside off the great, Uh, it's here. If the position is outside of the great, you should output the statement. Okay, so you specify the position outside of the great police are entered the positions. Okay, so now, again, accountable on being lamented will start over again. Okay. Okay. Just giving you hints. And then, at exceptions for handling Gwynn when the player doesn't provide number, it's the only really integers should be used as indexes. But for example, somebody put their A Yeah, you should provide only indeed your values as a great position. Okay, So bear this in mind. So these are to boost asks. Feel free to add them there And when you have will have the solution. Feel free to publish your that by file. Okay. With ready solution. I want to run the bite on file. It's always by using bite and keyboard biting. Tricky wording terminal and the name off the pilot on file. Okay, guys, that's this project assignment. Hope you will have no problems if you will have problems dealing, solving and the hints won't be enough for you. Feel free to contact me. I'll be glad to help. You were learning. People make mistakes. Sometimes it's hard. So even if takes time, for example couple of days to find out the right solution, it's not a problem. Yes, so the way it's hot, but the goal is nice. So So go ahead and reach the goal. And I hope I will see you guys in the next videos. Thank you.