Python 3: Programming in Python for Beginners | Arkadiusz Włodarczyk | Skillshare

Playback Speed

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

Python 3: Programming in Python for Beginners

teacher avatar Arkadiusz Włodarczyk, Professional teacher

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

73 Lessons (11h 17m)
    • 1. What will you know after this course?

    • 2. What is Python? Installation and first execution

    • 3. Variables, creating and running external srcript, interactive Shell


    • 5. Types of Variables

    • 6. Math Operators

    • 7. Exercise: adding VAT to products

    • 8. Semicolon and ENTER - assigning multiple values to variables at once

    • 9. Assignment operators

    • 10. Playing with Strings (Slicing, adding and having fun)

    • 11. Importing libraries - basics

    • 12. ATTENTION - important lecture about common mistake regarding functions

    • 13. Taking data from user and type conversion (casting)

    • 14. Comparison (Relational) Operators

    • 15. Instruction 'if' why INDENTATION is IMPORTANT in Python | DO NOT SKIP!

    • 16. Calculator Exercise

    • 17. Values different than zero

    • 18. Logical Operators

    • 19. Loop while

    • 20. EXERCSE: Summing numbers

    • 21. Loop for

    • 22. Break and continue

    • 23. EXERCISE: Guess Number

    • 24. What are Lists? Basic operations on lists

    • 25. Checking if element is 'in' or 'not in' the list

    • 26. Operating on lists with Functions

    • 27. Tuples - what does immutable mean?

    • 28. Dictionary

    • 29. Sets

    • 30. Operations on sets

    • 31. Nested types

    • 32. Processing nested types using loops

    • 33. Dictionary inside Dictionary, Dictionary inside List - when to choose which?

    • 34. Extracting records from nested dictionaries

    • 35. EXERCISE: Dynamic dictionary with definitions

    • 36. List comprehensions

    • 37. Python generator expressions

    • 38. Dictionary comprehensions

    • 39. Set comprehension

    • 40. EXERCISE: Finding numbers that are divisible by 7, but are not divisible by 5

    • 41. How to create a function? What problem functions solve?

    • 42. Passing more than one argument, function with multiple parameters

    • 43. Returning values 'return'

    • 44. Your own modules imported

    • 45. enum - what it is and why you should use it?

    • 46. EXERCISE: Arithmetic sequence, summing numbers up to entered number

    • 47. Measuring PERFORMANCE of code | How well (fast) some part of code work

    • 48. Function as argument of another function | How to measure performance of func

    • 49. Default arguments

    • 50. Keyword and positional arguments

    • 51. EXERCISE - checking if value is in container

    • 52. Variable length argument

    • 53. Local vs Global Variables - scope - lifetime of variables

    • 54. Immutable vs mutable objects

    • 55. Shallow vs Deep copy of object

    • 56. Lambda | Anonymous functions - what are they? when should you use them?

    • 57. Drawing random numbers - creating a program that checks if you hit the monster

    • 58. Random events - choice vs choices function

    • 59. shuffle - shuffling cards in 'war' game

    • 60. EXERCISE: Drawing elements without REPETITION - lottery game - 6 numbers from 49

    • 61. EXERCISE | GAME - Drawing random chests colours with random rewards

    • 62. EXERCISE | GAME - drawing approximate values to a certain value

    • 63. What is a file? How to create it? Why do we need to CLOSE it? How to save data?

    • 64. Exceptions, try, finally block on practical example

    • 65. Opening the file using: with... as...:

    • 66. Reading the content of file - read vs readlines, splitting lines, encoding

    • 67. seek and tell - changing and reading the position of last operation in file

    • 68. append - adding text at the end of file

    • 69. a+, r+, w+ - two function file opening modes

    • 70. Keyword except - catching exceptions - EXERCISE - loading names and surnames

    • 71. Generator functions - yield keyword

    • 72. EXERCISE: Generate infinite amount of numbers multiplied by themselves

    • 73. Send method in generator functions

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

Save your precious time by buying this Python course. You will learn how to program in Python in a fast and easy way!

If you want to learn a language that can be used in every circumstance and earn good money then you are in the right place!

All of this is presented by a young man who shares his knowledge, so the language used can be easily understood by everyone.

The course is designed for those who don't have any prior knowledge about programming. It doesn't matter if you have never written any programs or you have no idea about programming... After my course all of this will change. You will bust the myth that programming is a difficult thing only for the few!

Python is:

  • easy to learn and read,
  • fast
  • universal (tons of useful libraries available)

Python is used by:

  • Google (Youtube)
  • Facebook 
  • Dropbox
  • Yahoo
  • NASA
  • IBM
  • Mozilla
  • Reddit

After this Python course you will know:

  • how to import and use basic Python libraries

  • what are the functions and how to use them

  • how arithmetic, logical and relational operators work

  • how to operate on Strings :-)

  • how to create conditions with the help of conditional statements

  • what they are and when to use lists, collections, tuples, dictionaries

  • how to create advanced expressions for generating, lists, dictionaries and sets.

  • how loops work

  • how to handle files

  • how to create random events on a mini game.

  • how to support JSON format on a practical example - requesting content from API servers

  • how to install external PyPi packages

  • how to handle Visual Studio Code in Python

That's not all!

The Python course has a lot of practical exercises.

Python is often used by professional programmers. Even tho they uses daily other languages, they still use Python to solve complex problems.


I believe that everyone has the ability to develop software if they are taught properly. Including you. I'm going to give you the context of each new concept I teach you. After my course you will finally understand everything that you code.


If you have any questions regarding the topics covered in this Python course, please feel free to ask. I'm always happy to help those who want to learn!

JOIN NOW and become Expert in Python

Meet Your Teacher

Teacher Profile Image

Arkadiusz Włodarczyk

Professional teacher


I am the author of 27 very popular video courses about programming, web-development and math in Poland. I've also created 7 video courses in English. Over 280,000 people enrolled in my courses. I put all my heart into creation of courses. I always try to explain everything the easiest possible way. I'm sure that my courses will help you in the programming and web development adventure :)

I believe that everyone has the ability to develop software if they are taught properly. Including you. I'm going to give you the context of each new concept I teach you. After my course you will finally understand everything that you code.

I've been developing websites for over 15 years and i've been programming for over 10 years. I have enormous experience in that matter and I want to sh... See full profile

Related Skills

Technology Python Data Science

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. What will you know after this course?: Hello, my friend. Welcome to the video cars regarding Piped on. This course consists off over 70 lessons and it's over 10 hours long. Yes, it's so big. If you're asking yourself each time when you learn something new questions like why the window envelopes? Why they're constructed like that and so on. Then you are in the right place because I would explain you everything. The regarding the vital from scratch. I believe that everyone has the ability to develop software ive they are taught properly, including you. I'm going to give you the context off age new concept I t Jew. After my course, you will finally understand everything that you coat what you will know after discuss. As you can see, you will know lots of stuff. You will know semantic off fighting, which means meaning of words. In Parton. It would be fluent in this language which will allow you to create whatever you want. You will know things like functions operators, how to parade in string, conditional statements. Differences between these collection stop of dictionaries went to use each of them how to measure the performance and so on lobes how to handle fires importing pipe and libraries. And that's not all I showed during the course. A lot off practical examples. Okay, So you might be also asking yourself Why should you choose my cars? Because I have enormous experience in teaching other people and I do it a different way. I always explained everything from scratch. I do not omit anything after discourse. You have knowledge. And what is the most important thing? Ability Toe read, fightin without any problems. If you know how to read, fight on libraries, you condemn program whatever you want. My courses are updated frequently you have held regarding cover Top is if you have any questions, you can just ask them. I really love helping other people. What you should know before discourse This empty space suggests that, Yeah, you don't need to know anything. This is a course for beginners. You can just start watching discovers without totally any knowledge regarding programming, you can just watch it and become somebody who can program in Titan. Who am I? Well, my name is our cottage with Africa, and I have enormous experiences you can see in programming in developing websites. And also I have over 100 thousands off students who have enrolled my courses. So yeah, lots of people believe in me. They are mostly satisfied. As you can see, here are sample common sample reviews about my courses. You can read more about more reviews regarding my courses on Internet. If you have any questions, remember feel free to ask because I love helping others. Okay, I will respond as fast as possible. So please go on, have a good day. And thank you for watching the first introduction video. 2. What is Python? Installation and first execution: Hello, everybody. Today we're going to Donald fight on. I would tell you what they spied on and I would tell the world is a programming language. I will also show you how to have your first interaction with vital. So how? Toe order pipeline To do something that you command. And in order to do it, we need to first download fight. Let's type Iten in Google And then we will go into fighting that our website is an official website off vital. There is a section that is called downloads and here you can choose your system will choose Windows and we can choose from this place here the newest version, which is 3.7 point four. If you are using other systems jobs, critical market does or other platforms you and download the bite on for your system. So let's can come fightem. Let's save five and let's weigh the second until it downloads when we click here and we could weaken Ran. We're gonna have a set up message here. You should choose this. Think you're at bite on 3.7 towpath. Do it. Believe me, it will save you time when you want toe act Despite on from something with this cold command line, you will not need toe right path toe the fightin to where it's installed. You were just need to type Iten. Okay, that's all. And you can just execute fight on things. So is this a few times in future? So choose it, click on it and what you can kick install now. And as you can see, there are many things being instead now relaxed under library interpreter We would talk about it. So So this is really not only a language that is being installed there lots of things in style in this package. Okay, let's no close it. And well, we have in started. But now how can we open the thing that we will work with, right? Well, here in windows here we can creek on this think And here we can type here to set right so we can type here I the l A which sends for integrated, which means there are lots of things in their development. So this is a place where will develop our applications In part I don't environment So this is the place where we will spend lots of our time, right? And when we could go on it, we have got something will discolor Shell. Okay. Show is a place where you can have in direction with Pichon interpreter and with shells itself, you can type use a few things. For example, two plots do. And when you could enter, you see as a result for so you can send him operations that should be interpreted by interpreter. So interpreter is interpreting eso. It's analyzing the things that you show here and it changes it to something good is called bike of You need to know what is programming language. Well, the truth is that I'm taking talking to you right now in English And you understand me, right? Probably. But you know the problem is that Ah, if you wanted to speak with me in Polish, that will be probably problem. We will need tohave a translator. Interpreter from fightin is something like that. It is a translator translates this think to something like that. 010101 Okay, I am not sure if it will change it toe exactly something that but it will change. So the sequence of zero and one What is that sequence? Well, our computer, he has got something. Will disc auld protesters and protesters interprets the jumps in voltage involved in something like that. Okay. Ah. And these jobs are between zero in once and everything you see in your computer. Whatever you see. Like, you know, even this shell, the Web browser, whatever right is interpreted from zero and one toe. These things. Okay, An interpreter. It is changing thes language, right? The thing that we wrote here in tow this our computer interprets this and then we have got as a result, as you can see, for example, for or whatever we can send commands, for example. Hey, you know, I would like you to print, so I type print, and I would like to print you something like hell award, for example. Right. And when I click enter, as you can see, it printed for me. Hell award. Okay, so interpreter interpreted this line. It's changed it. 20101 sequence, some kind off and always concede then because computer could interpret zero in one sequence . Hell award. Okay. And as you can see, here is a commander I can put you whatever I want. Right, Prince? As you can see this, this doesn't work too, because print is something that is known by fightin. It is a command is a function. We talk about the Maurin future and we learned many, many more functions. Commands like that that will help us operate. That will make us more powerful, right? We'll be able to create more things will be able to change many more things because off knowing libraries that have got names like that. Okay, So the truth is that if you want to become a programmer unity land, lots off functions, comments like that and you need to know the syntax. So you need to know when to not make errors. So, for example, when you make something like that Hell award. And as you can see, I will not put at the end of these parentis is here. I will have probably something like a narrower like he was waiting for for me. Toe ended when I click under, but as you can see eat. Ah, you meet toe ride your coat the way it was expected to write on. So we need to lend the same tax. I need to lend how that coat should look like in order to note, make arrows like that. And do not worry, because when you make some errors, right, you always get something like that. The syntax error. Ah, message. And when you come for it and when he pays it here, you'll see that you will get lots off results that will lead to probably the fix for your problem. When I click here, you'll not this probably. Oh, you see, you're not putting a quote before the end of line. Okay, so that's why I had this problem, right? Ah, did the stack overflow is really great website. Probably. If you are asking yourself something, that question was probably already answered on this website. Okay, this great website, even experts in programming uses these website because it's just those of time toe every time invent the wheel from the scratch. OK, it's good idea to sometimes ask people instead off, you know, doing everything on your own. So when you see that the error like that, you can just put the Q and you get probably answer okay in Google or in the stock over floor, or you can also ask me, writing the questions and the answer discussion section. I'd like to help people. So if you have any problems the Lord War, I would be glad to help him. So we now know what this programming language. Okay, this is something that is usedto communicate with our computer. This language is translated into the 010 on. So the bike out and lighter, that code is interpreted line by line by our computer on, and we can see the result like that. Okay, So that's only good lesson in the future. Will Then how we should write things, why we use the quote, single quotes, care why Prentice's are needed and many other things like that. OK, do not worry. That's the only first Lexan. Everything will be explained better. You have any questions? As always, feel free to ask 3. Variables, creating and running external srcript, interactive Shell: and everybody. Today, we're going to talk about something, go discovery labels. And we'll also talk how that interactive show is working and how to create our own script. Okay, because so far we have typed something in this interactive said Like, for example, for past five, and we have acquired a result, like nine. That'll do. Imagine writing programs like that every time when you want to change something in your program, your would need to create it from the scratch inside this. Think that would be horrible. That's why we have got something. What? This cult scripts that can be run by despite and so we can save the code for later, and we can run it later. Okay, so how could we do it? Well, we need to click on file, then on the new fight. And then we have got a editor opened like these one. And as you can see now, this fire that is gonna be our script is untitled. We can change these. The name off this thing on deacon type here, some kind of cult. So let's, for example, print something like sample. Okay. And let's say it fine, save us and As you can see, the default place that it wants us to save it is where the pipes on this installed So we cannot type the name of our script. So, for example, sample and the extension will be added automatically. It will be that Be why? So we do this something like that. When we kick safe, probably it will work, but it doesn't need to because we are saving it in the pipe and folder. And it can lead to problems because there can be problems with window privileges. That's why it's when you have got a narrow. If you have a narrow, then save it on. For example, documents folder or on a disk that is not assistant disc. Okay, so you have got the message is you can do it, then save it somewhere else. And now we can just click safe. So we have got now sample saved. We cannot open this thing if we had to close it right here is a sample. But we can also do something that five open and then we can go to death documents and you can open that school right, because you can open it and we have got. It's safe summer so we can have a cold that we can reuse later. And now we can run it when you click on run and then around more. Do as you can see we have got here as a result sample. So it's working. We can change the code here, So I have just compiled a that we're using the controversy shortcut and now control plus V . And now we can run the motor. And as you can see, we have got the sample sent here to the output a few times. So it's working right. It's pretty cool, right, because you can make safe occult and reuse it later. Of course, this code will be a bit more complex in these one. OK, now it's time to talk about variables OK about things that it's called variables. And what is it This think is a container. Variable is a container that can hold. Thinks you named this continent like, for example, ABC, or it can be more self descriptive like, for example, age, speed, name or something, girls, right, You can name it and you can put into it like into these boxes here, some kind off content, right? So variable when you look at the name of a rebel variable. So it is something that is able to Very it means that you can change the content off these books any time you want to something else. So why would you need something like variable? Oh, well, the simple way to explain why you needed is that Well, when I write something like that four plus five, I have got the result here, and I don't have it anywhere saved. Right is I've just losses. I can't take this nine from here and do something moving later. Right? But with variables, we can do it easily. We can write, for example, a he calls four plus five. And then we can use this label, this label that we called a later and we can send it to death out so we can send the value later out So I can do, for example, like that Print a. And when I ran the mogul. As you can see, we have got denying here on the out we can at even more or change that value so we can change it to later to something guys like for example, 10. Bring a And as you can see now we have good. You tend because we changed the value of 8 to 10. So that's really cool, right? Because we can now use reuse that value later. Right? We can do something also like that. A equals a plus five. What does it mean? It means that I want to add toe a the value that was there. So it was nine here, right, four plus five piece nine. So nine plus five. So let's send it to the output like that. Run. And as you can see, we have Good. Now 14. That's true, right? So we can add the value that was there before. So this is the use of variables. We can change the values inside off the labels. Who can we use them? And off course. Right now we put the data the information manually. But in future you will get the content for these variables and from for example, database from a fire from the user. Right. So right now it is. It is just a simple examples. So we do not make it complex. We just assign a sane means that we put the volume manually, so we just type it like that. Okay, so this is a variable variable is a container that holds some kind of content, and this content can be integers like these one, that sequence of characters and other things like that. But we talk about types of rebels in the future. Lectures for now. Just remember what is what is very and why do we need this concept in order to understand what is interactive shell? Look, you have probably noticed that every time when I ran the module we have got here a message like that restart, which means it restarts the shell. So it means that everything that was written before doesn't belong toe that shell anymore. It disappeared. Okay, Everything that you've done from before. But it also means that you have good now access to everything from this script. Still, even though the script has already bean run So when I type print A, you will notice that we have good steel value. 10 inside a right. We can add to a for example five and we have good 15. We can steal work on the script that been run from this place. Okay, That's why this thing is called interactive shell, because you can have an interaction with the scripts that are run. Okay, we can do whatever we want with this creep like that. I know that right now, when if you are a beginner, it might no feel like is useful. But believe me, it's pretty cool feature that is, that doesn't exist in other programming languages because in other programming languages when you run program, that program will just return result that you can use in other programs. And it's all. But you cannot, you know, work on every variable, every function, other things like that from discreet. Okay, so that's pretty unique. That's why this think is called interactive Show. And you can also, for example, restart the shell manually. And from now, when we do something like that, as you can see, we will get the message Name. A is not defined, which means it has not. Bean created doesn't exist. OK, so from now everything we start from scratch. Every time you restart the shell, you start from scratch. It's also good to know that when you create, for example, variable a and you sign keep five interactive shell. You can print the value without having to use the print command. You can just type a this can see you have good. The volume. You? Well, I did it a few. Um, I hope I haven't confused you here. So you do not need to use the parent in order to see the results like that. Okay, by the way, do not worry when you make mistakes when you make errors like it because it's pretty common when you are starting your programming adventure. Really? You will make tons off errors and it's normal. Do not worry. It's good idea to practice. Okay, So after this lecture, try to create script. Great. If I name it, whatever you want. And after it saved, saved. If I create some kind of called great two variables assigned. So put some values, interred it into these variables and print them on the output and then run the module random. Run the script and see the result. Okay. And play with variables. This good idea toe Every time when you finish lectures from discourse to practice on your own, the same things I did. And in addition to this is a good idea to give yourself, like, 5 to 20 minutes break after each lecture. Before you start practicing because you're brain, we start to forget what it has learned. And this is the best time toe learn things. Because if you do not let him, do not let the brain forget the think After 20 minutes, it's gonna be in your brain for longer. It's gonna, you know, you're gonna fortify. You're gonna reinforce Did these memories off things that were about to be forgotten. Okay, so remember, practice practice in the game practice programming after each lecture. Do the same things that I did in the left. And in addition to these, remember to look how I write code. Look, I added space here. I didn't need to, because if you don't, the program will run to right. But look, this doesn't look as good as this, right? And as this, this is cleaner coat. Try to create clean coat, and in order to create a crank out, you need to look how I do it. And you need to make habits off making cream coat from the start. If you are. If you're gonna be lazy, and you do not have a clean coat from start, you're gonna have problems in future. And people will not look at your cold like it was professional and you might not get work. You, uh you have problems spotting some errors because when your code these horrible written really believe me, it's really hard to analyze its killed like that and to sport arrows. You will make errors because off chaotic coats also remember to focus on starting good habits from stop. Okay, So to sum up in this lecture, we've learned what are variables. Variables are containers that can called values, different types of values. But we'll talk about these types in future lectures. And we also learned that in order to safe the coat for later for re use for later usage, we need to create a file like, for example, this one. And after saving it, we can run it. We in our shelf. What school? This shell is interactive, which means it can have interaction with the programs that that were run, right and ah, that's pretty awesome because, well, you can create a new vory able like, for example, that and at five to it. And then you can print it out, right? You can work with the script that Waas run already. That's all. Good lesson. Thank you very much. 4. Comments: Hello. Our brother today we're going to talk about comments. Well, our comments comments are notes that you give to yourself or maybe another programmer that we look at your script in future so you can describe your coat, right? You can say what is happening under the comment about the comment or the left off government, whatever. How to create comments. You use that hash sign shift plus free will give you this, son. And after this sign, everything did you type is gonna be ignored by the python interpreter. OK, so this thing is not gonna be interpreted. You can just run their module and everything will work fine, right? You didn't get an error if you don't use it as you can see, you go now. Have some problems because the interpreter doesn't know what is that thing, right? You haven't assigned anything to it, so it's not a variable. You did something like that. It's gonna work fine. Okay. But otherwise isn't work. So in order to create comment, you put hash and then you can type something cute. So, for example, let's create simple program that will add two variables to each other, have to do it. Well, let's talk about it. Fires that say, uh, this program adds two variables and shows top some. Okay, So the A equals for example. Five big equals, for example for and some equals a plus big. And I want to see on the result the some of this on the outward. So we're gonna print it round module, okay? And as you can see, we have got nine here, so everything works fine. You can also at common after the line like that. Okay. So example Meribel named a very odd, bold named B. Of course I'm over doing it right now, but I'm just showing you how you can create. Come. The heart sign allows you to create single line common. If you want to come in more than line line, you need to do something like that. Diabolical, biblical and double coat. As you can see, the color off the code below has changed because everything things now is gonna be commanded. So it's gonna be ignored by the python interpreter. We need to finish it also by doing something like that. So after this, think everything is gonna be interpreted like normal, So I do something like that. It's gonna be interpreted Onley after this. Ah, this place, right? You can also do the same like that. We've using the single ah quote governments. Okay, so round module, As you can see, all these things were ignored. Total Onley things that are after are gonna be executed. Okay, let's go see, We have got to you free. Everything works fine. So this map comments are used to give notes to yourself or to other programmers. 5. Types of Variables: Hello, everybody. Today we're going to talk about basic types off variables and we also gonna talk about how we should name our variables. So our coat will look better for others and for us in future. Okay, So what type of variables do we have and what is type of a rape? Well, when we create ever able So we, for example, creative Rabel named a and we a saint to it. So we put into the fire Able value five. It means that we've just created a variable. That type is in teacher okay and teacher and in teacher and we can check it when run the program. And we use something with this called a command A function type on. We do something like that. We send there a the variable A to see the result, as you can see, will have as a result, int which means this in teacher it means that you can you have got now inside of it in teacher Very okay. We have also something will discolor float numbers and it means that that our numbers with fraction So, for example, free point 14 and this is called flowed numbers type I have to run demotion for salary. Hi. Be as you can see, it's flawed Now it's very important to notice that we've used the dot here. OK, we didn't use coma. We used that in order to create fraction we use that. Okay. So as you can see who could not free point sorting, we get also type that is called string. It is a sequence off characters so one character next to each other And in order to create string, we need to tie the name for rare able than the equal sign and then use the double quotes for single quotes and between them string the world that we want to put their. So, for example, we can pulled my name, our cat. And when you're on the module name, as you can see we have got now are cardio. Ah, that's working. But we can also do it with the double courts. As you can see, you can do it My date too. But what's the difference? Well, if I wanted to, for example, create a sentence right, and I would say I am for all in Poland. As you can see, this thing got interpreted and we can now five sentence and I have got I'm from Poland to you. But have you used a single called Our Interpreted? Doesn't know where we start or where we end this string This sequence of characters, right? Because he's like hate. This started here and added, Here, What is that? Things after it. So A Z, you can see we can. If you want to use the single up a stroke in the sentence in the string, then it's better to use the double calls. Or there is also another way toe. Do it by using, for example, backslash. When we use backslash, we are saying to the interpreter that this single quote is a single chord that we want to show. It's not a single quote that is used to open and string OK on a random module. As you can see, we've got the result. Probably when the type heres something like that, you noticed that the type off it is as the air. So it's string right, the sequence off characters. The next thing you should know is about bowling type. So there is a type is called booing. It can hold two states the true. And the falls, for example, is big. Yes, it's big, so it's too bull. Boeing went aground in module. Yes, big. You can see through into notice that we haven't used the quotes here, even though this think is working fine. Right? Uh, when we use quote, it's no longer bowling type around the program, you can see we have got here, the single quotes added. And when we do it like that, we have good information that the type is last year, which is string. So that works only for true and false. And it's very important for you to know, concedes Bull um that you need toe have here the first letter speak okay to be large if you do it that way in Strathcona even work because false is not defined. It's like we are right now. Trying toe assign toe is big variable ever able that is called false. But false was not declared. Okay, So as you can see, the pipeline language is case sensitive. Every single letter is very important, which means when we create a variable that we call A and we signed to it for and around the program on DWI type your small A, huh? As you can see, we have got five. When the type big bang larger, we have got four. So this is no the same variable. Okay, Because we have got here different case off the letter. So it's very important because you might make some mistakes because off that in future, be ready for that. So the pipe in this case sensitive It's very important to also know that when you're creating names, they should be self descriptive. What does it mean? It means that when you look at the name of a rebel, you should already know what is inside of it. So, for example, sighs off section. So when I'm looking at it, it means that this thing is gonna hold the size of section. If I could name need for example G, I wouldn't know. What is that? Think describing, right? And believe me, you should for on the start try to name your names like that. Okay? The good Hobbit To save you tones off time and the next thing notice that every word that I started in this variable I started with the large letter O s. It's easier to read the code like that. Because if I do it that way, as you can see, I need to focus for a second longer. Maybe. Maybe second. Doesn't matter you to focus longer where the next world is starting. Okay? No, it is better to do it dead way. Every new word Did you start ever work? You start inside. The rebel name should be capitalized so they should start from the large letter. So two to mop. The types of rebels describes what is inside that very favorable. It's good idea, toe create self descriptive name off the rebels. And also it's good idea to start every words inside the name of a Rabel with the big letter . That's only a lesson. If you have any questions, it's always feel free to ask 6. Math Operators: hello about it. They were going to talk about arithmetic operators. So we're gonna talk about operators that are commonly used in math. So the operators that work on numbers plus sign can add two numbers to each other. So four plots six will give you 10. The sub tract can subtract two numbers so you can say nine minus free is going to be six. Multiply can multiply numbers so multiplied by four is eight. It's very important that in order to multiply two numbers you should use that asked the risk sign. OK, you shouldn't do something like that because this is a syntax error. It's involved syntax because X is, you know, it can be very able, right, the name of a Rabel. But X is not something like multiply operator. OK, I know that the muff in schools you learned that X issues for multiplying, but in when you're using computers, when you're using python, you gonna use the Asterix sign. In order to divide the numbers, you should write the slash. It's also work to notice that when you divide two numbers, the result off to in teachers when you divide two integers is float number, right, Because you have got here the dot here to that zero. Even though you do not need to rise zero, As you can see, that zero was written, which means that this is the fault number. Okay, There's also something good is called parentheses. I am sure that you've met with them. They can change the order off. What is what should be calculated first, right, So you can get something like that to plus four multiplied by free. You need to know that in March this thing won't will not be executed. First, you were first multiply for by free, which is 12. 12 plus two is 14 right? But there are times when you want to change the order off execution off what should be evaluated first. So now the computer sees the parentis is here, and this thing will be executed 1st 2 plus four is 66 multiplied by free is 18 right, So that's how it works. There is also a very cool operator doesn't exist in other programming languages, and this operator can raise the number to the power off the number that is on the right side. So when you do something like that, too. Race to the power of free. It will be called to eight because in order to write to the power of free, you need to multiply this thing by itself. Three times so so multiplied by two is far. Four multiplied by two is as you can see. The result is a so everything works fine Free, Multi writes of the power Off to Is nine, because Free multiplied by free is nine right free 27 free movie Piper Fees 99 multiplied by three is 27. That's how it works that school because other programming languages in other programming languages, you cannot use the operator. You have tow import some library in order to raise the number two some kind off power. Let's talk now about the floor division when you use that want slash. So the typical division when you divide nine by two as the reason you gonna get the 4.5 of the float number. But when you use the floor division, you will get the number that this here on the left. Always. So even if you did something like 13 divided by, for example, nine as you can see. The result is gonna be one when you do 70 divided by non 17 floor with floor division is gonna give you one. So you do know draw around up or the result. Right? But always run it down. Okay, That's how floor division works. Well, floor is at the bottom, right? So you look down, okay? You have got also something. Will this called model operator? It's called the remainder operator. It shows you what is left after division. So it takes this part into consideration. So when you do something like 13 model you nine we got as a result for and you're like a But this is not this thing welcomes. Not exactly this thing. Ah, well, the truth is that four divided by 90.44444 When I was talking about that, we're looking at this part. I I was saying that we're talking about this thing here. So I was talking about the number that is in the counterpart, not in the dominator, but the counter. The thing in the fraction at the top is called counter. And the thing that is at the bottom off fraction is called Dominator. Right? So let's training a bit when you have, for example, one divided by free. The result the 0.33 fearful figure. Right? And these think is the counter and this is Dominator. So if I did one multiple free, I would get is the result one and I do go to a model of free. I would get as the result, too. Right free model of free, huh? What will be the result of this? It will be zero because free divided by free is 1.0, right? It means that there is no remainder. There is nothing left after division. But when we do something like four divided by free, we have got to hear still reminder. And we only look at this reminder that this reminder is really what one divided by free. Right? So four multiple free is really one. Because it is what was left here, right? One was the counter off dominator. Five model free is really to six. Model of free is zero and so on. So five Model two is really one. Why? Because five divided by two is two. And how and the half is really something like one divided by two, which is the half right? And this is the hard that we are looking at the counter, So one model toe would be one. So that's why five Modelo two is one and it might look a bit complicated. It start when you're looking at it and you might be also like But why do I need it? Do not worry Right now I'm not able to show you how we could use it because you do not know what are conditional statements. But you should notice that the thesis behavior repeats to model free to free Modelo free zero. Right? As you can see, we have got here from the result one model of free one to model of your toe free Maduro free zero and it will after four it will go again one to and the gain zero. So these behavior repeats right? You have got the same always value here. But that value here is changing and you can use it because ah, you can change the way your program works every three times using the instruction like that in future. When you learn the conditional statements, you will be able to check if the result off some operation like that is equal to one. Then you can, for example, change the background off the table to Rhett. If it's equal to two, then changes to black one is equal to zero, then changed to green. Another again. Rat block. Green, red, black, green, red, block green. You can do something like that. I know that it might be a bit confusing right now. I just wanted to tell you that something like that has got a meaning. Do not worry. We did not understand it right now. I'm sorry. If I have confused is you do not worry about it. Just you should right now. Just Len, how this operator works back because I know that might seem like it's not useful. But believe me, this operator is one off the most useful operators in programming. You can do many useful things with it. The during the lesson. Thank you. 7. Exercise: adding VAT to products: and over about it. Today, we're going to practice the things that we have learned so far. So arithmetic operators and of arriba. Let's imagine a situation like that. You are in Europe and you need to pay taxes like, for example, value added tax that is added to the product. The tax is called that from value added tax. OK, so this tax is added to the product and we want to add the stocks to the products. Like what? Like, for example, shoes and, for example, TV, whatever. So let's create for able that we hold the price without the tax, the price off shoes and that's assigned to it 100 price off TV and that's assigned to it. For example, 2000. And the prize we've up talks is called Net Price. Okay, like that. And now we will create variable that we hold the gross price. So the price with the value added tax and it okay, so it equals to what 100? And now, for example, multiplied by one 25. Okay, let's imagine that we've just added 25% to the shoes on the price, and this is divided right and Well, this works. But why shouldn't we reuse the very variable from here? It's good idea to reuse it right like that. Let's now use the sheep loss Home Control. Please see and enter counter policy. As you can see, short skirts are really impressive and they can be helpful. And now let's do something like that that no, that's changed net to Gross. And we need the price of TV. And now it works. Fine, right? We've just weaken Run the program, Onda. We can ask for the gross price of shoes. As you can see, it works fine and gross price of TV. Everything works fine. But ah well, the VAHT, I think, should be in another of Arabe. Why? Because let's imagine that we have got lots of Arabe als. Well, the truth is, that right now the valley for the shoes and TV, we put it manually here, Right? But the truth is that we would probably retrieve these values from database and wield Retief give for example, 100 variables. Well, 100 values like that or maybe more, maybe 2000. Imagine that. This program is enormous. And one day ah, somebody The change devote from 25 to for example 20. Can you imagine yourself changing each line? Imagine that You have got your laws off lines right there, right? With laws off lines and you have to have changed from 25 to 20. OK, you should You could probably use some editor to do it for you, but it will be so. I'm profession long, right? You repeat yourself. So when the times that's not a good idea. That's why you can create another variable and hold inside it. For example There what? The actual over 25 for example. So oh, how toe now and do something like multiplication like that Let what we could do something like that one plus 25 divided by 100 right? 25 divided by 100 is really zero point went if I so we can do something like that And the problem is that well, this thing is equal to 1.25 like before. But there is an order off what should be multiplied first, divided first or added first. The order right now is like that. You do this thing then you did this, think and then you add the result from this. So this and we do not want it to work like that. We need to change the order using parentheses. So we gonna do something like that. So just change the order, right? And, well, now we can run the program. And as you can see, it works fine. And the cool thing is that when somebody now changes, they've got to, for example, 20. We can just change it in one place and they see the works fine. Even though we had many girls prices here, Great. The next very important thing you should. And no. Is that when you see something like that. So when you see the repeated many times, even even two times, right, But imagine that the calculation like that is repeated here 1000 times. So every time your computer needs to divide and at the result of these division toe one So it takes time. This this thing will never change. Right? That expression here or my DVD, Maybe we wanted to change it. We would need to change it never every possible place. So it would also take lots of time we could just create another. Were able calculated that, for example, like that. And now, as you can see, our program with see Ron. Fine. So girls price of shoes. But the cool thing is that the calculation is done on Lee ones here and you say you star the calculation inside were able right. So we started in your memory in the ram, in the room, the random access memory. Is this why you need rum? You start there, the variables and you can access this. Ah, more and the time you want without having to count again to calculate this thing again. Just calculated once and then you reuse it. So imagine that you have got here, As I have said earlier, many times, lines like that and because you did it here, not hear. Every time you need to calculate it, only one and you just reuse the value. That's why variables are so good and also even wanted to change somehow. The calculation. You will do it on Lee here once. You wouldn't need to do it so many times. So every time you feel like you could change the calculation that these done many times is a good idea to create a variable. Right? Okay. It was looking like that. So there's only good lesson. I suggest you to create a few more products and calculated the girls price of the product as the exercise. Remember, you should exercise after each off lecture. You should do the same things that I did in the lecture. Remember? You will never be a programmer. We've all practicing. Okay, That's only good lesson. Thank you very much. 8. Semicolon and ENTER - assigning multiple values to variables at once: hello we have learned so far did, in order to create a Rabel and assigned to it the first value we need to type the name off variable than the equal sign, then the value that we want to assign. And that's all. We can run the program, and we get the value from to the very people. But what if I want to create more than one variety? So far, we've been creating it like that. We hit the enter button, then the name of a rebel, the name of a Rabel and their value for the next right. But what if you wanted to do it in one line? Well, then, if we do something like that, you will notice that we have go invalid syntax error, which means that something went wrong because the syntax is rock. Why it's wrong. Why our computer are why the interpreter that interprets that coat cannot see that this is just another very able to create when you hit. Enter the enter sign so the new line is interpreted by interpreter that it is the end off instruction. The instruction has just ended. Okay, that's why it works. But when you do something like that in order to tell the interpreter that you have finished the instruction already. You need to type something. What? This calls him calm, saying something like that and then it will work. You can add the space here so it looks better. And now when we type X, why that as you can see, the values were assigned properly. Now you're probably thinking why I added the cynical and here and here. But I didn't. It it here because it works like that interpreter is gonna assign toe x five and then he will not is the teary semicolon. So the next the things that are after the semi column are gonna be interpreted as the next instruction. And then why equals still he not? This is the semi column, and then the Z equals well. And you do not need to add the semicolon here because, well, it's just not needed because you don't have any other instruction after it. So semi column is really an enter for the interpret interpreter. So it is the sign off a new line. Then you have just finished the instruction. Okay. When you delay did think that Britain would be like, Hey, let's assign toe x five and then assigned toe It also spies. Why? And something like that is like, Why? Well, I wait a second. I don't know what you want to do. You okay? You need to inform him. Hey, this is the end of instruction. So that's one way. And also I will Did you, in this lesson how to assign the pipe and way many variables in one line? Because it's pretty simple in fighting you fight and you can just do something that a comma being comma see, he calls. And now when I type for example, one coma to come up free, one will be a same toe to will be. Think Toby and free will be a saint Toe, foot sea that school, right? And I think it's ah faster to write and easier to read. But what? This girl you can even assign here for examples string So test and, for example, here bull value and we'll also work. Fine. Great, right. So the types doesn't need to be on the same If you want a toe A sign to each off the variable the same value you could write a dead weight, but well, it doesn't look so good. You can do it in the pipe. And even better, you can write something like that. Okay, That's only good lesson. Thank you very much. 9. Assignment operators: Hello, everybody. Let's imagine a situation like that. We have got ever able X and the value of this variable is fight. And now I would like to increase X by two. So how to do it? Well, right, Something like that. X equals exports to And now when they run this program, you will notice that as the result we have got seven. How does it work? Interpreter Always look at the right side when he sees the assigned equal sign. OK, so when he look here, you look at something like that X with this X is like that. What s acts? Oh, I have to look. And both where the eggs was declared. Okay, he's here and he is looking at it and he says that it's five. So he changes the extra five and then he has good five plus two here, and he needs to make a month operation and he changes it into seven. And then after that expression, after this thing was evaluated, eat that seven will be assigned two weeks. Okay, That's how it works. That's why we can just write, execute and we can increase the value that was before X by, for example, to end. We will also lend a shorter way to ride this thing weaken. Just write something like X plus equal sign, too. We'll take this under the comments that this will be ignored by interpreter and now winning Randa module. As you can see, it's still seven. So this operator is a short way of writing the expression that looks like that so you can use it with any other operator like, for example, minus. Which means that far we'll have five minus still, and that's the result We have got X. We can multiply by two or, for example, free. Free, multiplied by five is 15 and as a exercise, go on and try other shut way off writing the longer expressions like that, they're doing that lesson, Thank you very much. 10. Playing with Strings (Slicing, adding and having fun): Hello, everybody. Today we're going to play with strings. We're gonna lend how toe at Sprink another string and how toe slides them and how to create big strings that are long. Okay, So let's start from creating a single thing, for example, name. And let's put their my name on a cat. Let's create another variable. Let's call it last name and that's put them my surname. So for dark and now I would like to print both at once. So my full name at once. So I need to create another variable and put inside name. And now how Toe ed name to last name. We need to use the operator, plus so something like that. And now we can print the full thing. Like As you can see, it's working Fine. But hey, there is no space here. There is no space because Well, I didn't Eddie, there is no space here and there is no space here. We called ad space like that, but that's not a good idea, because what if I wanted to print it later? Without that specs, right? It's best at this pace here. How to do it Well, in order to create space. We go not do something like that. So double coat space double quotes. So we just end it a spice between the name and last name, using their plus signs and no one around your model. As you can see, we have good space here, so it works fine. What if I wanted to create a very long streak? Like, for example, this is a tax that was stake in from somewhere And thats no cup it, and separated, as you can see, is long. It's how to read. It's good idea to when you have a string like that Teoh somehow you know at the Ender. But there is problem. As I have said, High Tone thinks that enter is end of destruction and how toe do something like that. Well, we can, for example, use the backslash. Backslash is gonna inform your interpreter that the text has not finished yet. Okay, so like that. And now when they're on the module, everything works fine. That's one off the way. There is also one more. You can use comment here. That's funny, because when you're on it, as you can see, it's working fine. But there is small difference a Z can see. We have got enter in the place where we put it hero, because he this is a tax that waas and we hit the enter here and we have got also here. Enter right when we did dead way. As you can see, every foot thing was in one line. There's a difference, and you might be also why you could assign comment to the variable. Well, interpreter. When he sees that comment is assigned to variable, it's is then not ignored. It will be interpreted like if it was a long string. That's how it works, OK, so if you do not assign the common and where it means that it is the common one big note. Otherwise it is just a long text. Okay, now let's learn how to slides strength and believe me, it's very useful. For example, you want to check very often. If the first letter is big, it is capital life. Or sometimes you want to check if the 1st 3 letters are equal to something. Believe me, it's very often used when you are gonna program in future. So how to do something like that? Well, the first thing you need to know is that when you have got text, you start counting from zero. So the first Lecter is at index zero second at war Index one. So it's always minus one, right? The last letter, the six letter is at the Index five and what is funny? Imp item. You can count from back in other languages. Mostly, it's not possible, so you can put minus one and you can come from the end. So how to use the information that we have just left? We can do something like that. Use the square brackets and access the first index. So the first letter that this at the zero position when I ran the program. As you can see, we have got here now thing because this is the first letter. Okay, Face value with name. As you can see, it's a if I want to access the last letter. I can just type something like that minus one. Great. It's zing when I want to actus every letter bother the 1st 1 I can do something like that. So when you add the column here like that, as you can see when you don't get to stop at the left side. Anything you would get the entire string. But when you put one on the left side, you'll get everything. Part of the first letter Ive you put here one what will happen? As you can see, we have good Onley First letter. So everything upto index one right? So if I put you five, we have everything upto index 5012 free Sam and it's concede it's five But I said upto five and we need toe at the world, not including the fifth Element. Ok, uh you can also do something like that. Mine is one which will mean that Do you want to actus everything but lost a limb? Everything but no last two elements. So not including last two elements You might be like how to remember it. Well, you don't know the need to worry about remembering it because every time when you're gonna want to use it, you can look it up on the Internet Or you can play with the simple string like that and just get how it works, right? Not right when you do something like, for example, that from one to free what we we get are and key. So let's look you 01 So from position 12 to and free so to the second position or to third position, not including that hurt position the not worry if you cannot memorize it because believe me , even I When I want to slice drink, I always rely on it by putting simple strength here in the beytin and trying to see how it works. Really, The most important for you as a programmer is to remember that that you can do something like that, that it's possible to slice string, right? The thing that you have to remember how we have works is that you can access each element like that. So the first element, the second, the lemon, the third element is very important for you to remember. Did you come from the zero, not from one right. And it's also very important for you to know that in order to access the last element, you need to type minus one. So you understand these two things you are ready to go and every time when you want to act is more than one element, you can just really do not worry. It's not so often used. Body are is very useful. You will see when you start programming. And the cool thing you need to know is again when you run the program. The module in Piketon. You can still access the full name here. Right? And you can now do something like that. I want to access the last 11 right? So I want to access full name minus one. That's an exercise. Create variable link and do something like that, Http. And now type here, for example, the domain that you want to access. And now check if the link starts with http. You do not know how to check. You don't know how to make conditions yet. But you know now how to slides. That's drink. And get that http right. And in future, you will learn how to condition how toe check. If that sliced string is equal to death, that's that way you can later in future track. If somebody types http or he hasn't time, right? That's all. Your lesson. Thank you very much. 11. Importing libraries - basics: Hello, everybody. Today you're going to learn, I think probably the most important topic Inp item Which is how toe import libraries and what are functions. So far, we have learned that there is something, what this cold print. And I told you that it is a command. It is a function. So it is something that will execute some instructions that were created by other programmers. So the truth is that when you write print, your computer is looking somewhere for the print name for the print function, and it will execute the instructions that are responsible for printing the think that dissent between this rockets to the out. So here, right, that's how it works. And there are many, many, many, many more like that. So in order to create toe use function, you need to write the name of function, and then the parent is, is so that brackets here. Okay, it's very important. It means that you are invoking the function and you need to send their an argument something like that, and it can detect it can be number. It can be variable can be many other things that we will talk about the future lectures. Also, For example, when I do it like that, you will see my name. When I do it like that, you will see here the four. Okay, so it works Fine. But Oh, is that all? Is it only one function like that? No title is enormous. You will see some Why? When you go to that dogs that bite in that work you'll notice that we have been to do something good despite on standard library which you can use freely for free. There are, like many libraries, each library. Did you see here? That m s I l i b g r p p W d. Whatever you see here has got lots off inside functions. So Commons, like print that you can use for free. Let's go to, for example, something like math You not is that we can use here. For example, seal we can I come? For example, the square root off the number, the descent and someone. There are some complicated trig automatic functions toe whatever It's already been programmed. You do not need to reinvent the wheel. You can just use the work that was done by somebody as what is more cool you in future when you become programmer, when you learn how to create functions, you can also share functions like that with others. Well, this girl, when you go here to the pipe and package index, there is right now above 124 thousands of packages available for you for free that were created by community. So by people like you in future, you can just use it. And now you might be Do I need to learn all these things? I thought that you might be like that. That start No, The short answer is now you do not need to learn all these things. And believe me, I do not know even 90% of them. The truth is that you just need toe learned how toe look as a programmer for the information. Okay, So when you are in need for something, you need to know how to look through these things. And you need to know how toe Reedus, crip, shins off functions. So when you read description like that, you can instantly see that that function will return the square root off X. Also, I just need to write something like that and I will get the square root of X, that's all. That's how you learn functions. And the truth is that you do not need to remember off them. You just need to remember that they exist. That's good idea to remember that they exist. And when you need something like that, you wouldn't know where to look because it's not possible toe. Remember every possible function. There is thousands of them, and people create each day. New one, right. So it will be just impossible to remember off this. Okay, we are calm now, so let's use some other functions. There are some building functions, So why functions that you do know the need to import? For example, these a be us. It will return the absolute value of a number, which means that if you give it for example for will return for you, give it minus toe. It will return you to sew it. You always return the positive number. It will just change the negative numbers into positive numbers. That's all. That's how it works. And it's often use, really, believe me. And this is one of the building functions, right? We can also use something with this cult help you can send to help. For example, a B s and you'll instantly see how dysfunction works. So you do nothing to remember As I have said, how it works, you can just send to help the name of function and you will get the information how it works. Great, isn't it? And well, there are some did you need to import like, for example, the math. You cannot do something like that Math square road off, for example. For as you can see, math is not defined. You need to import it. In order to import it, you need to write import and then name off the library you want to import. And now, since the shell is working right below, you can use below this comment. You can use the math library. You can know, right muff dot and, as you can see, would have gotten out too. You need to remember that you must write math before it being toh also access that metal using their dot here. Okay, you cannot write something like that because this method is not defined. It's really important that even if you have imported the math library. You still need to use the dot here. If you don't want to use the dot operator, you need toe imported other way, going to type something like that from month import and then the name of function you want to import from. And now when we type it like that, it would work. But what is fun? It will not work when we do something like that. Uh, it's working because we have imported it here. Okay, Um, let's ah, arrest. Restart the shell. So I do something like that. Restart the shell and again when I dough like that, As you can see, I got four. But now I do something like that. It will not work. So there's being worth because I use the import math here. You need to remember that there is a shell state, right, and everything from that place is gonna be remembered. So I have forgotten about Did we have imported the math already here, And that's why it still worked here. But, uh, here we didn't work, as you have have noticed, right? Okay. You can also for the school, as you start the shell again import every possible function like that from math import and we news need to use the asterisk. Asterisk means that I want to import every function and now I can use. For example, the ceiling function seal is apt op. When you look up top in your room, you will see the seal, right? So it will always move the number up, as you can see from for it. Move it up. So it is running always up. It doesn't matter what is written here. Do always run it up. As you can see, we have got always as a result for five and I can use easy now these function also right because we have imported every function from math. Ah, using this construction. If you had used that construction, you would need toe eat right each time math before the name of function from so you get toe so you would have to write math that seal mapped out square root. Right. So to sum up, in order to invoke function, you type the name of function and then you send an argument so that will be somehow interpreted by the instructions that you do not know how they work and you do not need to care about it because it was already written by somebody. You can just reuse the coat just by typing the name off the function. And that's great because you do not need toe re invent the wheel. You can just use the work off others. And what this girl in future when you become programmer, you can also create functions we were and how to create functions in future. And you can help others, right? You can create library like, for example, in the fight like that and somebody asking, imported and he can use it. So the module that five here is really some kind of library right now. It's nothing, you know, great, because you could just we just know how to create variables and make some simple math operations on them part In future, we will know how to create great things. That's only the lesson. Thank you very much. 12. ATTENTION - important lecture about common mistake regarding functions: hello today are we show you something that will help you avoid mistakes that are made by beggars. Look, we have got here have a Rabel name and we assign to it. Joan and I would like toa enlarge every letter. So I would like to have here Jay Oh, age. And instead off the small letters like that how to do it? Well, we could write it on our own right now. We don't know how to do it because we don't have, you know, molded for it. But we can use the function that already does it. Why should we reinvent the wheel when we can use something that can do for it? And there is a function that is called upper like that and this function increases their string. But this function is a bit different because you use it like that. You use it on string, this building function you don't need to import anything. So you do stuff like that. Name that upper and it will take it will enlarge all the letters here when he ran the module. You will see as the result nothing. Why? Well, because when interpreter cease a line like that he is going toe. Go to the definition off the upper function and he's going toe execute every instruction that will enlarge these letters here. And after he executes all the instructions, he will return here. We've there value like that. So he did the job and he returned it here. He just replaced this entire line with something like that. And when you rounded module, the result is the same because we have not used the print. When you use the print, as you can see, it works fine. We can now also do something like that. And we are. And it will also work fine. And John. Right? But still, let's see if we had changed the name variable. But as you can see, we haven't changed. These very we have just printed Jonah Que There's all we we just printed out the John here , that's all. OK, we haven't done something like that. Name equals John. Now we have both Jones with in large letters. Even we did it dead way. Oh, yeah. Then we have replaced what was inside the name with the Children like that. Okay. And the I hope that now you understand how it works. You should now exercise that big, we think cited. So there are many more functions like that. For example, lower. If you had used lower, it will make all letters that are inside the name small. And there is also something called the sculpture cop. Pity lies. Things spelled like that. Oh, he's not. It's been like that. I apologize. This function increases its in urging the first letter. But all others, uh, our mate smaller, right? So that's how the capitalized function. So you have just lent freeing functions upper, lower and capitalize. But the most important thing is you know how functions work when the functions invoke. So when you use the parentheses, the interpreter goes, summer executes every possible instruction that will make what the function shouldn't do. And then it returns to the place off invocation place like that and return something like that. Okay, it is very, very important to understand it, and because otherwise you might make lots off mystics because off it. So that's a good idea now for you to exercise a bit, make of a Rabel called thing with your own name and play with it like I did. They're telling the lesson. And always, if you have any questions, feel free to our 13. Taking data from user and type conversion (casting): hello With each lesson, you know more and more. And because you know now what are functions, you can finally make a useful program like one that can, for example, take data that condone low data from users. Will not assigned to variables manually values like, for example, that but we will take it from users. So how to take the characters from users? How to take data from users from the input? Well, we need to use the functions of this cult input. And after it off course, we need to use parentheses because no, that to invoke function, you need to use parentheses. This means for interpreted that he needs to go and look up for the name input and do things that are responsible for taking the characters from import. When you run the module, as you can see here, the carriage science of the one that is blinking care is waiting for us to put something here. I will put, for example, for and what happened? Nothing. Because, well, that think that we did right now is like equal to doing something like that. Okay, As I have said, when the function goes somewhere toe make the instructions that are responsible for that. For how function is working, that interpreter will come back here and return the thing like, for example, in this situation for and at all. So we need to assign that value so something so we can reuse it, right? So I think that's the best idea to use. They were able here, right for with goal of Are Able a oh and around the module. Now when we put five, it means that here is five right? So it means that we can access there. Variable called a like that. And as you can see, we have good knock your fight. But you should notice one thing. Hey, these string, I put your number but he restoring why and what will happen if I want to add two strings to each other? Well, let's start from adding to stinks to each other. So let's create another were able and let's take two things from user, for example, five and 10 and that's it. Aped blast big and the you probably noted. Five. Last N is equal to 15. It's not 510. Why it's 510 because far a is now a string bit is not a string. And it's like that 510 You added two strings. You connected to things to each other. Result because you need to remember that everything that you take from user is gonna be always interpreted as string. It's a good idea because we don't know exactly what can be what user can, right? Right. So if you want to change the string in tow in teacher, you need to use another function that can do it for you. And this function is called Guess what int like that. So you need to only do something like that on input. And now here we will have in teachers. We can check it out. Also like that. You can see we changed the values. The five and 10 0 you can also use the flow function like that. But well, we are adding to numbers and that are not, you know, the flow of numbers. So we do not need toe do something to use the float here. But you know, we ive you had assumed that somebody want toe to fold numbers. Why not? You should use the float. Ah function so that think that you change the type from one to another piece called Casting . Casting like that casting allows you to change one type off for ableto another type of variable. Okay, I think that so we have landed in order to get numbers like that, we need to use casting, right? Okay. So we can not print the results like that instantly. And if we work fine five. And then we've just added it. But what if I wanted to say something like this? Some off A and B is equal to like death. Will that module work? Fine. Who is that working? Fine. We can see that must be asked the air not in. Which means that hey, he was expecting string not in teacher, because Hey, here is string. Here are two integers and we cannot add to a different types to each other like that. You can it float toe end. It will work because these are numbers, but you can add string toe end. You need to remember about it. So you need to change their result off that into string again. Okay. If we didn't like that, of course it's gonna work. But the result will be 510 Because these are strings now, right? But if you do it like that, we have toe somehow change it back to stink. But the result we do not want to change it's like that. Well, in order to change it, you need to use the str function. Right? But we do it like that. Of course, the program will work fine. Five and 10. But we have unexpected result. Right? 510 We need to tow use it on the results. So after the A is added Toby, we gonna use the s the air function on the results. So we need to use just the parentis is on both of them at once. Right? Like that. And now when you around these module, as you can see, it's working fine. Great. We need to also add a spice here, so Well, it looks a bit better, right? Like that balm five, then. Great. Okay. There is one more Think, Do learn in this lesson. Like, for example, that you can send an argument toe input function because, well, right now, really, when I put fighting and 10 I don't know exactly why I put here five and wire. Put your 10. I know because I created this program. But you know, the user will not know what he's exactly doing. So I think it's a good idea. So say something like a program that that's two numbers to each other. And then you can ask the user for the first number, uh, first number second number when I'm around them. Although, as you can see now, it's asking us for the first number and second number, right? Right. And we also need to add the spice here in order to make it look a bit better, right? Okay, there is also one more thing that I want to show you. In this lesson, it's the calm, a sign that you can use in the print because, you know, adding each time spaces like that is taking loads of time. And so why bother doing it when you can use instead off the plus sign the coma? What will happen? As you can see, that space was added here automatically because this is a default separator for the print function. You can change it. We won't won't talk about it right now. But, hey, this is a default operate. Ah, separator. And each time the pulling function sees the comma, it will add there, um just the space and show the next thing that is after their coma. And what this goal is that you do not meet toe Use the casting on this now because you are not connecting this to this. Okay, so you do not need to use their as the hour function, the disgusting that in teacher result into the string. Right? So it's also cool because you can now do something like that. Some off. Okay. And we can now say, Well, a is equal to some. Some off a that is equal to okay. Like that. Uh huh. And oh, you are right. Plus be is equal to And when you around the module you're not is that we have got here some of our physical to five. We don't need toe that spice you right? It's important that we do not need toe. Remember about it because you have to. Space is now here. Song of the game. Some of a the difficult 05 plus B is equal to 15. No, I should have said that be these people too? For example, Been is equal to Ah, Okay. No one around the module, some off aided is you could toe five. Plus B that is equal to 10 is equal to 15. Great. So the cool thing about it is that you do not need to tow at the spaces here, and you do not need to care about what type is that variable here, Right. The print function. We just work fine. And it will print out the result like that. Right? But you see, off course in tow. Okay. It was the the casting method. Like ain't here because otherwise the result is 510 Like I said before. So it's time for exercise mega program that we ask user for his name and his age. And after it show up what is his name and tell him what will be his age in one year time. You have any questions? As always, feel free to ask 14. Comparison (Relational) Operators: Hello, everybody. Today we're going to talk about companies on operators. Sometimes they are called relational operators because they check how the thing that is on the left side relate to the thing that this on the right side or the compare how four is 25 And when the sign looks like that, it's checks, if for is greater than five. It's not true, right? It's false. And the expression like that is gonna be trenched in tow. False. Because the interpreter checks something like that checks the expression like that. That and it changes later in tow. False or if it was true, so if we had a situation like that, it would be changed in tow. True. Well, we can check it easily by doing something like that. It's 10 greater than five. Yes, it's two is five lower than to know. It's not true because five is greater than two. Okay, that's how the company reason operator what works And but you might be like high. But when I could use something like that well, in future, you learned something would be sculpt conditional statements. These are statements. These are instructions that can check if something is true or false, and depending on the situation, you will be ableto execute different instructions. We talk about it in future lectures, but imagine that we can do something like that. If 10 is greater than five, then, huh? Do something like that. Otherwise, do something else. Imagine you want to create a program that will check how much money somebody ends, and depending on the money the guy earns, he needs to pay different tax rates right when he earns more king to pay more and, well, you can do something like I pull put me, we can do stuff like that board. Hear how Marge you and per year, Right? And you can assign value to, for example, something goddess called your errands right. And you can use the value you can later check if your earning is greater than, for example, 20,000. And if yes, then you can do something as you can. For example, said the tax rate to hire right, That's how you can create better and programs, right? That's that's finally, we will be able to do really great stuff. So there are others like, for example, smaller than so it get checks if two is lower than, for example, five years. It's true if two is lower than one. No, it's not true. And here is the most important. The equal to think. Well, look, five is equal to five. It's 25 is equal toe, for it's false. The important thing that you need to notice here is that we are using the two equal sign because you cannot do something like that. These sign is used for assignment. Remember about it because this is a very common mistake that is made by beginners. So in order to check if something is equal to something else, you need to use what to call signs. And now look, we'll create favorable A and we'll assigned to it. Five. And we'll create a very will be. But we will take that variable from imports. So from the user. And now I would put here also five. Now when I type, you see that five. He's like that when I type be the five years like that. It's five pickle Toby. No, it's not because what Because B is really a string because be was taken from input. It is the thing that I was talking about in the last lectures, right? Remember about it. That string is not the same as in teacher, but you can always change it. You can do something I did A is equal to, but we need gonna change. Be in tow, integer using the casting function in and, as you can see now is through. There is also operator like that. It's five. Note equal to fight. It's false because it's equal. It's five, not equal to four. Uh, it's through. Is five greater than five? It's false. It's FISA greater than or equal to fall. Five. It's true. So if you use on the equal Sign single co signer like that, you can then check if something is greater than or equal in the same time. Right? Six is greater than or equal to five. Yes, it's true. The that one works the same and well as an exercise. Use these one play with it, play with companies and operators because they are very useful. In the next lecture, you will see why, because you learn the conditional statement. If you have any questions, as always, people to ask, Thank you very much. 15. Instruction 'if' why INDENTATION is IMPORTANT in Python | DO NOT SKIP!: Hello, everybody. Today we're going to talk about conditional statements which are statements. So they are some kind of expressions that can condition so they can check if something was true or not true. And depending on the result, we can decide using something like conditional statement. If you want toe execute the instruction below conditional statement so we can do something like that. If something is true or maybe not true, then I want to execute instructions below otherwise else. If this is two, or maybe not, too. Then I want to execute instructions here. If something else again is two or maybe not through, then do these things. And in all, if all all of that instructions that both were not too. Then execute instructions here. So these is Conte shown on state. You can check if something was true or not to. And depending on situation, we can execute instruction but below right when something like that can be used. Oh, well, let's do a simple example. Firstly, that's great. Variable A. Let's assign to it. Five be That's a sign to eat free. And then let's check if a is greater than be Ah, the way I wrote it. Here is the called pseudo coat. It's written like that. So this is not true Coat. I just wrote it like that. So it's easier to understand. Here is the piped on where syntax that you need to You. So if a is greater than being, so that in order to create conditional statement in it, right, if word and then you need to write parentis is and inside parentheses, you need to type the expression that should be checked. So, for example, five is greater than be right. And if five is greater than be, then you need to add the count here and after it. You need to make an end. And here I would talk soon about trying to make an indent here, so in to put some spices here and the instruction that should be executed. So, for example, let's bring a is greater than be like that. Let's run the module. As you can see, A is greater than being, and it's troves. But when we change, for example, uh, it did to, As you can see, we haven't seen anything right, because, well, the expression here is not to. It's false okay if we did something like that. As you can see, it's false. We did something like that. We have got that instruction here printed. So that's how the easiest is easiest Conditional statement. Looks like about this little look we can do something like that is greater than being. And in other case, we can do something like, uh, well, that the problem. We did not write the else here. We just right l eight out, that's all. That's how the syntax for L stiff looks like in Piketon A is lower than being then print A is lower than the otherwise still telly. When all of these cases are not true, Run something like that A is he called to be and we can take Maybe these numbers from the user. Right? First number second number five free is greater. Done, B It's too. Now let's type free on five. A slower than being okay. Five and five. A. Is equal to be crazy is working fine. But there is a few more things that I need to talk about. Let's take this thing under de command so these instructions won't be executed. And now what will happen if I delete this indentation here, so the spaces here, what happens? I can run the program. Syntax. Error expected an indented block, which means that the interpreter interpreter expects the indented block so so spaces before the print. It's an error in vital. If you are coming from another programming language, you might need to get used to it because you have to make indentations, so you need to make some spaces here. Want to free for you can also hit the top bottle stop but in right and it's OK in this idea because when you hit top button in the fightin I d. On this. Ah, all that one hit from Top button will be changed into four spaces, but the to visit you could use only one specials. Um, probably means that we could go with you become and like that. Okay, And it's gonna work Fine. But there is some kind of convention. So the way we should this programmers all program and the convention say that we should use you for spaces. Okay, for some people say stupid. But I think for is better. You shouldn't use tab later, the top button, but in this. I d e specifically you. Can you stop because top is changed into four spices? And so you do not need the o Cara about right? You have got instantly force prices. You just get one button is, I think, easier than thinking. 1234 times specs, right? Eso the indentation is very important. Why he might be. Why? Why? Why? Why? Why? Because imagine the situation like that. I won't do right here. One more instruction. Like for example. Ah, a is greater then be and I am so happy about that. But it when I around this module, As you can see, we didn't guess on the result is greater than be neither. We didn't get this one, but as you can see, when I typed Hey, here, I got here. What a string. Mm. So we tried to comfort two strings to each other. So this is a common ero you need to do compared to integers to each other. Right? So you need to dio make some casting. So you need to change types lying there. Now when I take 10 5 as you can see both off. These instructions were executed properly. Okay, But look, when you run the module and you type, for example one and in the second, Number five both off, this instructions won't be executed. In our case, it was something that we wanted to happen. But what if you know you want the debt in sections to execute? Lola, let's run the module. Let's type this the first number. For example, one and then five, as you can see, steal this instructions was not executed. Why? Because it was on the same level off indentation. So there were the same amount of spaces here for and here for space is okay. So in order to, you know, remove that instruction from that condition, you need to have the indentation that is, you know, equal to the conditional statement to have it on the same level. Like when I'm using my miles here, you need to be on the same level. And then this instruction is not, you know, under this conditional statement. Now, when I run the module and I type one and then five, as you can see, we have got this thing printed. Okay, So right now you understand that indentation matters that you have to make indentation in order. To what toe even be able to add something under the conditional statement. Right. Like that. Well, thank you on. And if you want toe, remove one of the instructions from conditional statement, you have to just, you know, remove the indentation. Right? The first instruction without indentation will not be under the under that conditional statement. Okay. And now let's back toe that. Let's check if it works. Fine. The module 15 It is over the fight. That's true. One and one A is equal to be. 16. Calculator Exercise: Hello, everybody. It's time to practice. You need to remember that if you do not practice, you will never become a good programmer. Okay, so today we're going to create a simple program that will be able to at the numbers subtract numbers, multiply two numbers and divide them. OK, so we got going to create a simple calculator. Okay, That's our job. So you can try to do you don't Europe. If you do not know how to do it, then play with me. Okay? Watch that lecture and stay with me by looking what I did. But after this lecture, give yourself 20 means and try to do the same thing or even expend the calculator back some new operations. Okay, Okay. Let's go back to our calculator. So what do we need to do? Firstly, we need toe. Ask the user what he wants to do if he wants to add, subtract, multiply or divide numbers. Okay. Going to create some kind off men, Okay, But how can we create Manu? How can we create something going to act like Manu that we look similar team and I think that we could just creams this for options in the council and it looks like many but we need to be able to choose from the options that right we need to allow the user to be able to choose from deceptions. I think that we could at, for example, a number before each topic. And if the user types one, we will allow him to add numbers. If he types toe will be subtracted, few types free he would be to to multiply he types for he would be able to divide. Okay, And now, as you can see, okay, and it's looks better. So it is some kind of manual, but we need toe. Ask the user for the number in orderto ask the user for the number we could use instead off the print function, we could use the input function, right? And after it, we could, for example, at the colon and the space. So he has the play space you after the Manu toe put something for for our program, right. As you can see, we haven't, you know, Colin suggesting that we should type your something. So when I take for example, one hour program ends because right now we just got inside our script, that one from user and our code looks like that, right? And that's all we need to do something with that one coming from the user. What we need to assign it toe some kind of a ripe so we can create a variable that will be called, for example, new option. So now we can decide depending on world will be chosen by the user what we want to do. Okay, so we can now use, for example, conditional statements. If man option is equal to one, then we will add two numbers. But we don't have these two numbers. So we need to also ask for them, right? So let's great vory wielded with co first number and let's assign tow it first number that will be put here by the user. No, let's do this thing. I think with the second number. And now let's bring the result like that first number plus second number. And now let's it around. The more you know when we type one. As you can see, we can type the first numbers of example 10 and five and nothing Campins why I did again on purpose because you need toe. Remember, You need toe. Take it deeply into your mind that these think if you do not use the casting if you do not youth something like the head, then this thing is really a string right contract. It can type human option. As you can see, it's one with that single quotes here. So it means that it's string. So we will need to compare it like that. Okay, are we can't stay like that, but we need to use the casting. Okay. Remember about. But hey, why not? What's that's change it to this thing and maybe lets us hear the signs? Like, for example. Plus, I'm a sign. Ask the risk and the slash Like that. No weaken. Just check you. He tied the ah, plus sign, right? And then we will add the numbers that will work fine too. Okay, So if you want to add this to numbers, we should also think about them as in. So we should do something like that. Otherwise we'll try toe to strength. Remember about it. The lives around the module that's the plus sign and let at, for example, five plus 10 barking. We have 15 Okay, So this is the first option from our calculator. We need to go into other options. So, like that? All safe. So in other case, if somebody in many option has chosen the minus sign, then will print the result sub direction right now on now. Okay, I'll save. Let's go. Because you can put Essman else if, as you want after each other, it is asterisk, Then we'll multiply and they're all safe. It's the slash. Then we'll divide this two numbers, okay? And else in all other cases, it means that somebody type something that was not expected. And we'll just tell him you have tied something unexpected. Okay, like that. And now when you run, the more do of course, the cold. Here I apologise. And now when we have something unexpected, you have died something unexpected because, well, we check it here. Right? Uh, when we does something like, for example, as the risk on we this I think four multiplied by eight. It me is 32 which is true. So our calculator is working Fine. But we have got steal something that it's not a good look. We have got here division right so somebody type slash and he wants to divide five three to gain five on now with zero. As you can see, we have got here an error division by zero and our program has stopped working. We did not want toe have a situation like that. We should check if the second number is zero before division. Okay, so in this case, we should check eighth. The second number is equal to zero if it's true, and now it's very important. We need to adhere indent because this instruction will be executed. If this thing is true, I'm goingto adhere Another England and this end. And we suggest that this instruction belongs to that instruction right to did conditional statement here the if a second equals so zero k. So we'll bring um division by zero. You cannot do it like that, okay? And otherwise, if it's not zero, if it's another various number that it's not cool to zero, we'll just divide these two numbers, of course, went to at the calm here. So please notice that I have good indentation here and to you on and this instruction when this instruction is true, then this conditional statement will be executive. And if this conditional statement this year than this one will be executed otherwise, these in section with execute. So now when you run, the more you ah, looking Nicole. When we type slash first number for example five and the second number zero as you can see division by zero, you cannot do it a soft dead and now five divided by one. As you can see, the result is five. So everything works properly. So that's how we have just created a simple calculator. You can add more to it like, for example, you can try to power numbers, right? You can use the module operator. That's an exercise you can create more options to choose from. And, well, it's an exercise. You should create this program from scratch. OK, remove everything that you can that you see here just created from scratch after 20 minutes After watching this lecture, you should practice by creating this program, it will be great exercises. You can see I am missing each time this comb here and I am doing it because I program in lots off languages, programming languages and hey, do not use that column here and somehow I really tend to ah, you know, lose them. That's that. That's that. How that that's my fault. And I apologize for that. But you know, when you're programming many languages, this small differences like these things and you know it's it's hard to change your habits when you when you're changing from one programming language to another, program it instantly and like our again. Again, I have forgotten about that color. So I apologize again. I hope you're not angry with me. I wish you good luck in practicing the fightin language by creating a simple calculator that don't get lesson. Thank you very much. 17. Values different than zero: hell over. But the thing that is place here is called expression. And that expression, after its bean executed, is gonna be changed into single value. So if a is greater than being in this case, it's false because five is no greater than big. So this expression will be changed into false. And if something is false, the instructions after that are connected to that in conditional statement are not gonna be executed. So I ran this module. As you can see, we have here nothing on the other hand, ones too, is it can see. The result is the thing that we have got here under the conditional statement, The instruction like that is here. But it's also important to notice that any value that this different from zero is gonna execute instruction. What does it mean? It means that if you type here, for example, big number like that As you can see, you have got here as a result test when you type even negative number. Also, you will see test ive you type string like that as you can see. As a result, we have got again best. But if we type here zero, then it's nothing. So zero folds is gonna give you nothing because it means that the instruction, the conditional statement was false. There is also one more thing on this is called none. It's also not gonna execute the instruction below the conditional statement, but we'll talk about it in future. It is something like nothing, right, like emptiness for objects. So you know anything that is similar to something that is like void like nothingness like zero. Then it's gonna You don't mean the same thing. It's false or zero, but things that are other than zero So in the number or examples were able like a variable A is now equal to five. And because five, it's not equal toe zero the instruction like that was executed. Behave. But when we change 80 you would notice that we don't see anything because A is equal to zero. Also, it would be like checking if zero OK, it's important because, uh, well, when you are making conditional statements, you can buy me steak. Compare something on, and as a result you will have a number that is not equal to zero, and the result will be true, right? And you will not know why now you wouldn't know the zone. Good lesson. Thank you very much. 18. Logical Operators: Hello, everybody. Today we're going to talk about logical operators. They are called logical because they work on true and false expressions through end ful statements. But before we go into water day, how do they work? I would like to present you the problem that they solve. Let's imagine a situation like that you want to get from the user number. Okay, so we need to create a Vrabel. So you go for example, number and we want to check if the number is in the range between one and 10. So let's just like that input type the number. And I will tell you if it's between one and 10. Okay, I will ask the user for the number. Okay, so it's a number we need to also cost. It's to end, right, Going to change the type from string toe and remember that the type from input is always strings going to change it into integer because we need a number. And then I want to check if that number is between one and 10. So how would you do it? You know, Barbara, do something like that thief and then inside you would check if the number is greater than one. Then then what? Now I just checked. If the number is greater than one and it's all but we do not know if it's not, you know, for example, 100 or 500 we don't know. So we need to do again. Conditional statement. If the number is lower than 10 then and then we'll green number between one and 10. Right? Do something like that around the module and we type the number. For example five. As you can see now, I'm varies between one and 10 then type number. These bigger than 10 is not showing anything. And here is the problem we have Get your to conditional statements on it. Doesn't look good, right, Because we have got to money indentation here. We better if we could somehow connect this expression with this expression with something here between this thing is called logical operator, and this operator will be called end in this situation. I will tell you soon what? As a said year, the logical operators works on true and false expression. Remember that this think that number is greater than one is gonna be changed into the true or false, depending on the situation. Well, let's imagine that with put into the number what? Five. So it's five greater than one? Yes. So these things will be changing too true. And its five lower than 10? Yes. So this expression will be changed in tow to and to end too means to Why? Because this is one off logical operators that if it's meet with two and true, it will be changed into true and works like that when you have to. And true, it changes their expressions into true if it has to. And false it would change it into false. It changed ceased feet. False and true. It will change in tow falls. It has false and false. It would change in tow, False How to remember it. Well, you can remember it by two ways. The conjunction and it's called conjunction is to only when both expressions are two. Okay, so we just need to remember that and we'll give you two above. Expressions are true, but you can also remember it another way. Lets imagine you're talking with your wife and she turns. You know, I would like a coffee with milk and you will tell toe. Okay. My wife I will buy for you coffee and milk. Imagine that. This our expressions. And when you come back with coffee and milk, it means that you have not light to her. Okay, but if you come back with only coffee without milk, so this will be full statement, right? Mick wasn't built. It means that you have lied to her because you haven't bought the milk. It's not enough. And the same situation goes with you. Don't buy coffee, but you buy milk. And if you told by anything, it means that you have completely lied to her. Okay? That's how you can remember it. You can feel that when you say the word and it means that you need to do both off the things at once. And in the same time. That's why when you do something like that, if the number is greater than one end in the same time number is lower than 10. Then this expression will be true. And when I ran the module, as you can see, I will type. For example 15 will not be true. When I type it is between one. And then there is also an operator that is called Are This logical operator will be, too, when at least one off the Expressionist to drew true false will give you two because one off that expression wants through two. False. True if you're through. But when you have falls and falls, it will give you false. So alter native because that's how are skilled is false, Onley went. Both expressions are false. That's how you can remember it. Okay, so or is false web of expressions are false. Contraction is through on the web of expressions are true. But also imagine a situation with milk, right and coffee. When you say to your wife Hey, I will buy coffee or milk. It means that you can buy one off that ah product and everything will be alright right by this. Oh, this Well, you can come back without one off this. You can buy ball of them. That's OK, but you cannot come back without anything. Okay, that's how you can remember it does so and when you change here to our maybe it's not a good idea to use the ranch. That's imagine another situation. Stick it under to comment and that's Ah, creative a reboot five and very be. And let's check if a is, for example, greater than be and, well, A or B is equal to five, then print test. So in our situation uh, also column in our situation when around this program, as you can see, we have got here test. Why? Because five is greater than two. Okay, so this what's true? But this thing was false, right? Because B is equal to to note to five. So it's false, but true or falls gives you what gives your too Okay, Um, it the cool thing is that when you change or and you'll notice that you need to tow have both expressions through at the same time as you can see now it's false. The expression the result of these expressions is false because true and false gives you true and false. It gives you false. Okay, um, it's good idea, toe exercise, practice ability to create some you know, play with these numbers and see what results he would get right. You can also use something with this cult. Not not means no. Right. So when you it can change truth to false and false to to. So if you have a situation like that right now, the result of it is false, Right? Because we don't see anything. We can change the result by using not like that. You can use the parentheses. So this thing, the reason off these expressions will be, uh we remember that he was false, right? So it will be changed into true. And as you can see now we can see the print here. Okay. So logical operators allows you toe, you know, connect more than one condition at once, right? You can create a complex one with numbers and so on. Right now, these are simple because I do not want toe make it too hard because you are now learning the same tax. So do not worry. I'm sure the do in future you you create something more awe advanced. Right? Okay. That zone did lesson. Thank you very much. 19. Loop while: hello over about it. They were going to talk about Loops. Loops allows you to repeat the instruction as many times as you want. It is very useful. Imagine a situation like that you want toe. Ask the user for the next five numbers, and after he put them to you right to your program, you want to add them? How would you do that? Well, you'll probably creative a Rabel like, for example, there, some assigned to eat some default value, for example. Zero. And then you would ask for. So import give met there number something like that you would also cast. It's the integer. So you have got the number. Not this drink, Andi. You would assign it to the number, and after it you would probably do what I think it would add it in the right to the some. So some plus equals number, and then you would ask again. So I think we'll need to type it like that and that because it was at the game, the new number that would come from the user. And then we'll provide the repeated and really gain repeating and they're being repaired in again repeated. Okay, So how many numbers have we added? 12345601 Too much. Okay, so let's debate it. But as you can see, it takes time. Your code doesn't good. Of course, this is the short culture. You can somehow manage it. But what if that, well, that there was some, you know, complex called doing things like that manually like that is no the way to go because we have got something or this cut loop and look will just repaid all this instructions for you . How are we like this example in the next lecture? Because it's a bit advance. Okay, let's focus on learning the syntax of the thing. It's more important for now. Let's imagine a situation where you want to just show 1st 5 numbers how to do this. Or maybe how not to do it will not do it like that. Right? Because if I had changed exercise to let's bring 1st 5000 numbers, then they don't take a bit to look. Okay, so we will use something. What is called while loop. Okay. You type the keywords. Why? Which is the English word? That means during that time that the condition that is gonna be after it execute everything that is in the body off the while. Look, So it's really similar to the if right, but they have good now here while and we now put the condition wife example number. Let's create the number is lower or equal to five. Then print numbers, right? There's number here. So if we did, you know, like it like that if you use the if so we use that conditional statement and when you were on the model, as you can see, we have got here on Lee Ones Zero. And that happens because conditional statement if executes the instructions that are connected to the conditional statement if the conditional statement is through and it executes its only once. Okay, But when you change it to my lip and we want the module, as you can see, we have got now zero repeated indefinitely. It is now called an infinite loop. If you want to stop this process, you need to hit the counter posse. Okay, control plus C on your keyboard. So the difference between why and if is that when the condition is true, it would execute the instructions that are connected to the look indefinitely. You need to somehow change the number inside the loop in order to stop that loop someday. So I think the best idea I would be to add to number, for example one. And because of that, after a few times the number will be finally what bigger than five. So it would be seeks someday and six is lower than five. And because of that, it will stop. But until that happens, it will execute and print numbers that are before five. So when we ran the module, as you can see, we have got no 012345 Exactly what we want it. So that's how the why the works it executes instructions eg connected to the look until the condition is true. Okay, will come back to the thing that we talked about the beginning in the next lecture as an exercise. But before you go there, I would like you to exercise on your own. Please try to print numbers not from 0 to 5, but print numbers from 5 to 0 off course by using lips. Okay, that's only good lesson. Thank you very much. 20. EXERCSE: Summing numbers: had over about it. Today we're going to create a program that will add numbers taken from the user. So what we have to do first? Well, we need to take the number from the user how to do it. In order to do it, we need to use the function, which is called Import. And let's ask the user, Please give me the number like that. And then we need to change that number into a number, because the truth is that we will get a string from it, right? So to use that in teacher cast and then we need to save it some. But let's save it into their variable. That will be called an R. That stands for number. Okay, so we need to now ask for another number for another number for another number. But we need to also somehow safe the some you need to have the some start summer right. The result. So I think we could create a variable that we would call results and let's assign to it at the start. Zero because zero is natural in when you're adding numbers so we could do something like result plus vehicle number and then we could do something like that. That that. So we have just asked for four numbers. And as you can see, we have repeated it four times. Which means this is the time that you need to use loop. Whenever you repeat something, it means it's a good idea to use. Look, so how to do it? First we remove that a needed a coat and we will create a loop. Why wide? Why? What? Why? Something is lower than four. Because we want to repeat the things here four times. Ah, and we need to create that something here. Right? So we need to clear the va revel like, for example, I and let assigned to it zero at the start. So why I is lower than for we gonna repeat, and it's very important. We need to use that top button. We need to add the spaces here. Right? So our vital knows that these instructions belong. Stood that Why lope? And now, when I is lower than four, this in sections are gonna be executed. Bob, when I ran this program Well, the problem is that this is gonna run forever. Why? Because zero is always lower than for going to somehow change that I inside our look like, for example, we need to activate one each time the loop goes through all these instructions. So now, because of that instruction here, after each repetition that I will increase by one. And because of that, the condition will someday finally be false, right? And that loop will just. And so, in order to see now the result, we need to print it after the loop. So we need to, you know, break, enter and then backspace. And here we can put something on the out. Like, for example, the result off adding numbers is and then we can, for example, show that it is a result. Do not forget that you need to add their cone here because that's how the syntax in the pipe and looks like. And after it, we can just run the module and that you can see our programming is asking us for the number . Okay, let's put you, for example, five toed and stand and, for example, for and the result is 21 vitals plus 2 +77 plus 10 17 17 plus four is 21 which is true. Okay, so our program is working. Fine. But how does it do it? Well, the easiest way to check it is just analyze your program. Like if you were the computer. So we have created death variable that is called result, and we have assigned to it zero because zero is now travel forward. Ah ah, Operation off adding numbers. Then we have created the variable I and we sent to it zero because, well, it's gonna be useful for us when it zero and we want to run. For example, this instruction inside the lope four times because zero is lowered and four. So the program is just checking the start of the globe, if the condition is through, is zero lower than four. Yes, it's true. So how? Okay, we need toe execute all the instructions that are inside the look. The first instruction is asking for the number. When we put the number here, right, this thing is gonna be changing to five well through his five like that. And then this thing is gonna change that five in tow through five into the five isn't teacher and we have a signed five to number That's how we do X right in this. Come back to that original coat and then when you have five here, we want to add that fight into the reason and we're adding it. So the result is equal to five. It's good idea, toe comment like that. Your code when you're analyzing, it's gonna have you a lot. And then, well, you need to increase the I. At the start, I was equal to zero and now is equal to one because of the operation here. And then we check again. The condition is one lower than for he has its service. We toe ask a game for the number and well we put here to so too was changed into the truth to sow into the integer and again plot five plus 27 Then we increase the I buy one because I was equal to one. Now it's equal to two and we check again. The condition is to lower than four years. It's your so we can ask for the number. So we put their 10 so 10 plus 7 17 win Chris I by one. So it's free. We again Check is freely lowered and for its True. So we again ask for the number and we put the four as the number and said, Well, four plus 17 East went, they won and I is equal to for no and we'll check is for lower than for. No, it's not true because four is a call to for So the loop is gonna stop executing the instructions inside its border. Right? The body off the loop is indicated by the spaces here, right? And well after it, we just print the result like that. The result off adding numbers is and we just used the variable did we created here and everything works fine. And the coughing is that we can now easily change, you know, here that condition from four to, for example, 200 we worked for 200 times, right? That's very cool, because you did not need to repeat your coat off course. This is one off the easiest example of how to use loop. There are lots off more other examples that will be more useful, but we'll talk about that later. Do not worry. I know that this doesn't seem like, you know, super useful because it is just asking for numbers, but believe me, lips is the most precious thing that programmer can have. Why he's programming. Okay, there's only lesson. Thank you very much. 21. Loop for: hello over about the today we're going to learn about the loop that is called for. In the last lesson, we learned about the look that is called Why and then Loop was executing the instruction inside its border while the condition waas through and we had to change somehow that condition that result of the condition each time. Because otherwise dead loop will be infinite. It would just around forever. So we had to do something like that. Not is that the case off look for is a bit different. That sin taxes that told a different not is that we haven't declared variable. I like that we didn't need toe assigned to zero Start and also we do not increase that I buy one. That look here will do the same thing that did here. Not is that when Iran, the module off workers we need to call on. And now, as you can see, it's just adding what for numbers that it did the same thing. But it's shorter. So how does it work? Well, look for works like that when the fightin let's look for it will execute these instructions of the instructions inside the body off. Look for as monetize as there are elements inside its range inside its scope. This think here, this is a function function called range, and it returns the scope, the range between zero and the number that is here. So it will return the least. We'll talk about this more later. But the list is just some kind of container like that that holds numbers or another type of writers. But as you can see, we are holding here now. Numbers 012 free. So these things will run four times because there are 1234 elements. Okay, for items insights of four each item inside this list inside these range inside the scope execute instructions here. And what is that variable here? We can call it whatever we want, right? It could be like that. Like that can be like that. Whatever we called it like that because with the same, like it was here, this thing with Holt, their numbers or with the values that are here after when, when the when the look for is gonna execute the instructions here. Okay, we can even print what is inside it. We were able here when he ran the module. As you can see in, for example, 40 2025 40 we've just added these numbers, but also no can see that the I waas at the first time equal to zero, then wanted to and then free. So we can shortly right this like that are like that. It's the same. Okay, so not is that you do. You do not include the last 11 right? When we say the range from 0 to 4, it means that we have got now elements like 01 toe and free, that's all it's not including the one here. So the cool thing about look for is that you can very easily go through. For example, 1001st numbers right from 0 to 1000 not including one the