Python for Absolute Beginners | TechPetraPro | Skillshare

Playback Speed

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

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

    • 1.

      Introduction to Python for Absolute Beginners course


    • 2.

      Add a project


    • 3.

      Your first program


    • 4.

      Print command


    • 5.



    • 6.

      Receiving input


    • 7.

      Type conversion


    • 8.



    • 9.

      Strings Methods


    • 10.

      Arithmetic Operations


    • 11.

      Operator Precedence


    • 12.

      Math Function


    • 13.

      If statements


    • 14.

      Logical Operators


    • 15.

      Comparison Operators


    • 16.



    • 17.

      Project Solution


  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels

Community Generated

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





About This Class

In this class you will learn the basic and simplest syntaxes in Python language. You are not required to have any background in programming or any previous knowledge about Python language. At the end of this course you will be able to discover how python language works and how it can bridge between your thoughts and ideas and the application on the computer. This course is not enough for you to start your journey in programming of course, but it can show you the path in case you are liking programming or not.


Meet Your Teacher

Teacher Profile Image


Where Technology Meets Expertise


Welcome to TechPetraPro - Your Gateway to Comprehensive Technical Mastery!

About TechPetraPro

At TechPetraPro, we're on a mission to empower enthusiasts, professionals, and learners with a holistic understanding of technology, petroleum software, programming languages, data analysis, and even the beauty of the Chinese language. Our diverse range of tutorials is designed to make complex concepts accessible, whether you're a seasoned industry professional or just starting your journey in the world of technology.

What We Offer

Petroleum Software Demystified: Dive deep into the world of petroleum software, gaining insights into industry-standard tools and techniques that drive efficiency and innovation.

Coding Chronicles with Python &... See full profile

Level: Beginner

Class Ratings

Expectations Met?
  • 0%
  • Yes
  • 0%
  • Somewhat
  • 0%
  • Not really
  • 0%

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

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


1. Introduction to Python for Absolute Beginners course: Hello everyone. This is Dan, and this course, I will teach you Python for absolute beginners. And this video, I will do a small introduction about what are the prerequisites for this course, what to expect from it? General outline, and how to get in contact with each other. First, the prerequisites for you to learn Python for absolute beginners is nothing. You don't have to know any other languages. You don't have. You don't need to have a background in engineering. You're not engineering students at all. You can be a medical student, or an accountant or a lawyer, and all to learn Python because it is the language that is embedding the whole world nowadays. What to expect from this course and this course, you will expect everything for you to put your legs on the Python path. For example. If you want to start with Python for beginners, and you don't have any idea about arithmetic operations, about how Python think and operate, you will get in trouble and this, and you will find some difficulties. Thus, this is a very small course that will give you these basics and give you the ability to learn any course you want that concerning Python as a beginner, as an outline, who will learn how to create a Python file. And also, at the beginning of the course, you will run your first program that's very interesting and you will Learn the print command, the very birds they're receiving. How to receive input from the user, the type of conversions, the strings of strings methods. If you find these, these topics weird because I will repeat that's for absolute beginners. If you don't know these topics, you will find problem when you start a really beginner Python course. Also, you will learn arithmetic operations, operator precedence, a math function. The if-statements, the big IF statements that we will work on it allowed to use a lot of, make, a lot of exercises and projects. They are very funny, very exciting, and interesting. You can finish the whole course in the evening. It is very easy until interesting. Also, you will learn logical operators and that competition operators. And for sure, we will have a project, a very interesting project at the end of this course. Don't worry, it's not easy. It's not the hard part is easy. Now, how to get in contact with each other in case you were running your program and you fell in trouble or you did a mistake and you didn't understand why you did it, or you saw my solution. However, you are not convinced. Please do not hesitate. You can talk to me through my email, my phone number in case you're outside of Lebanon and want to chat with me like voicemails, et cetera. Don't hesitate. Go for it. You can go for WhatsApp, telegram, et cetera. Also have my LinkedIn account to share our knowledge. And you want to ask any question you can alter my network and anteriors. I hope this course finds you well and you'll enjoy it a lot. Good luck. 2. Add a project: Hello again. Now let's start with the python. In order for you to start with Bitcoin, you have to download the Python. I use Python 3 and you have to use the bifan sharp. Let's start with Python sharp. This is a previous project I was working on. Now let's start to create a new project on Python. What we do is we go to the upper section file, then press new project. Here you name the new project as Python tutorial. You can name it whatever you want and then create. I want to use the same window. This stuff takes a little bit of time in order to download setups, create the virtual environment, indexing and et cetera. You have to wait around 30 seconds, I think. Okay. Now it's ready for us to use. This is the main window. It gives you a little bit of tips, et cetera. What we will do is we will create a new window for us. We go to the Python tutorial, then right-click and press knew you'd have different options too. We create a new file. This file I will call it python. That skill share. However, it is not done yet. You have to press dot pipe or it will take it as a fine, just fine, but it will not be a Python file. It will not highlight if you press a variable or a command. Thus, it is very important and a little bit off people or some people fall in this problem. And now we created our file. Let's start with programming our first program. 3. Your first program: Now after creating the folder, let's start with our new program or our first program. I want you to make this screen, right. Hello, then your name to the Python course. What are the command that brings this statement to the screen is print. Excuse me, print. Then, like this, then we create a low allele to the Python. Of course. Everything inside these two will be considered as a statement and will be showed on the screen how you run this program. You go to run, then press Run. You have to choose between main or Python Skillshare. In case you have different windows, you have to choose your window. Then we press Python Skillshare, and it is here. Hello, Hailey to the Python course. And by this, we finished our first program. Congratulations. 4. Print command: Now let's continue with the print command. And the print command. If you want to put inside the statement apostrophes or quotation marks, what we have to do, for example, I will try and both highly inside apostrophes. It will not run as there is a syntax error. Ali, inside the apostrophes is an invalid syntax. So what we have to do is to change the outside apostrophes and make them quotation marks. In this case, the Python will understand that inside the quotation marks is the statement and the apostrophes is included inside the statement. Now we will run it. And it's done. Hello Wylie to the Python course where alley is inside apostrophes. What if I want to make Python inside quotation marks while Ali is inside apostrophes. If I want to run the course, it will not work. What you have to do is to create a command for bifan that it is at that consists of three quotation marks at the two sides. And by this, he will understand that, Hello Ollie to the Python course, where Eileen is inside of the apostrophes and Python is inside of the quotation marks. And let's run it. And here we go, It's done. Now let's continue with the Python command. If I want to print quotation marks and 1, 2, 3, 4, 5, excuse me, I wrote white print. I want to print five apostrophes. Let's run it. It will run. However, there is an easier way. Print this poster p times by, excuse me, by this times five should be inside the bracket. Outside the brackets. Okay? The problem is unsupported operand type times. Okay? No problem. Bye this, we print five apostrophes. And by this we finish the print command. The print command a will be explicitly more elaborated. However, in the continuing of this course. 5. Variables: And now we will start with the variables. The variables are variables defined by the user to Python, inside which we give a value or statement, etc. For example, I will define a variable called price and then equals to 20. Then print price. The Python will show on the screen the price 20. However, the algorithm of Python is following. So if I write price equal 10, then the price equals to 15. What the program needs as price, it would 20 than price equal tan. He will remove the price equals 20 from its history and continue as the price equal 10. Then price equals 15. He will remove price equal 10 from its history and keeps that 15 and side has had inside its memory. Then print price, price equals 15. Now let's see a little, a small project or exercise. I'm going to define x equal to 10, then y equals to 20 than AX equals to 15, then y equals to tan. Then I will pass ask Python to print x, then y. Let's see what he will print. Please have small time to think about what Python will generate. Okay? You are right. Python will print 15 than 10. He will remove acts as tan and keep it as 15. Also remove wires 20 and keep it as tan. Also, we have something called the Bulgarian or true or false. Python is a sensitive language, as we said. Thus, it will be affected by small case or a capital case. For example, if I call it price equals to 20, then ask Python to print price. He will print it as 20. However, if I press instead of price capital, he will not understand what the meaning of price hit. He's telling me name, error, name print is not defined. Also, if I want to define price as price and printed, it will also tell me that name price is not defined. So what you have to do is to be careful about these top. There is a section in the Python that, that have to be capitalized. For example, true or false. I want to make a statement is expensive and equals to true. Then print price than print. This expensive. Also, if you want to make a world of a combination of two or more words, you have to make this lower case here. Then I will ask him to print. He will print 20 than two. If I put true as a small case, he will not understand it and make also any other as name2 is not defined. So we have to pay attention to this stuff. Now we will go with a small project. It is a very simple project. I want you to see if customer Ali Handan is a new customer or an old customer. So that start with printing name equals. And then let's say is nu equals to true print name. Then print is new. For sure. This program will not run. I did a mistake. I know I did this mistake, but I want you to know where is this mistake. Please take little bit of time. What is wrong in this video is named Alec. If I want to run it, you will not. He is he's telling me Ali is not defined. So I have to make Ali as inside of quotations or apostrophes for this program to understand that I is not a value, Ali is a name, and then run it. Holly is true. He is new. 6. Receiving input: Now let's move on to our next topic that is receiving input. If you watch TV and you use your remote controller, you can see that there is a button on the remote. So each button represent a function in the TV. So if you press 12, he will take 12 and take you to channel 12. If you press reverse. Now arriving to a new topic that it is. Now with our new topic, they're receiving input. The receiving input section should be a knowledged. Now arriving to the section of receiving input. In order to understand this section, you have to think about the remote controller and the TV. The remote controller is a collection of buttons in which if you press each button, that TV will take it as a value or as a command. Thus, if we want to make Python take something from a, take any announcement name number, anything from the user, how to use it. We have a function called input. And once these parenthesis are reached, it take like an execution input to it now. So let's start with asking you, what's your name? What, what is your name? With a space? And make this answer as name equal input. So Python is asking you what is your name and your answer will be registered as name. Then we will move on and press Print Name. Let's see what we have. What is your name? Ali? He will his printing Holly or if I want to make it as Your name. Is, Dan, stop that. Plus then name. That's how you print on the terminal a function with a statement. What is your name? Your name as valley. We have to make a space here last time and your name is on it. Let's change a little bit. Name is Allie and favorite color equal end port. What is your favorite color? Then we will move on and print name plus likes the Than plus, favorite plus point. Here let's see the program. That's, what is your name? Let's say rami. What is your favorite color? Blue. Rami likes the blue color. That's simple, that's easy. Let's change it a little bit with the print in order to simplify if we want to make the name numbered, age, favorite, color, favorite skill, etc. So we have to make it easier. We go to print who make quotation mark, function. Then write everything we want. Excuse me. F, then condition. And write whatever we want. Name, lives. Favorite, color than cotton, where the variables should be put inside these brackets. Favorite. Let's see how your name is. Your favorite color. Yellow. Sada likes yellow color or likes the yellow color with a point. And by this, we have finished this section of receiving input. 7. Type conversion: Now to move on to another section that is the type conversion. When we say type conversion, we have to make sure and understand that numbers in Python falls in mainly three classes. The classes is another topic that we will talk about later. However, the three classes are strain, float, and integer. I will make a small example in which we are, I will make some mistakes or a mistake to see what is the problem. Let's ask about the birth year of birth, person input. What is your birth? Here? If I want to print this, the answer of it, for sure, it will appear on the terminal because the birth year or any valuable that I introduce, it will be a string. Okay, let's print what is your birth year? 1990. Let's say it will print for me 1990 on the terminal. Let's ask for the age, or let's calculate the age. I will define a new variable called age. Now with simple calculation, h equal to 1021 minus birth year. And then I will ask Python to print H. It will not print it. Run, what is your birth year? 1990. It will make an error because it considers that the birth year is not an integer number. And, and I cannot make my integer number minus strain. It is not possible for the program it seeing like age equals 20, 21 minus 1990. And that's how I would see it. So in order for us to change this, we have to change the class of birth year all by making a new function int birth. Now, the burst year is an integer number and it can be removed from 2021. Let's print the age. 1990, 31. It's correct. This is a simple comprehension. However, I want you to make an exercise, please, after the question, pause the video and try to do it alone. That asks, a person has weight in pounds and then converted to kilograms. Then print has way it's weight or her weight. On the terminal. Please pause the video and try it yourself. It is easy. Let's start with the solution. If I want. First I have to define the weight and bounce equal to input. What is your weight in pounds? Then make the calculation. Weight in kilograms equal weight in pounds times 0.45. However, this weight in pounds as a string. Thus I have to change its class int weight in pounds times 0.45. Then print. Let's use the new technique. Your weight. Your weight is semi-colon. Weight in kilograms than kilo grams. Let's make it. But it is surprise. Okay, Let's run it. What is your weight in pounds? Let's say 125. Your weight is 56.25 kilograms? That's correct. I wish you did the right. Let's move on to another topic. 8. Strings: After finishing the type of conversion, Let's move on to the strings. In this course, you will learn a lot about strings. I previously started with the print function. Speaking about the strings and the double quotation, one quotation, etc. Let's repeat a little bit of what we said. Let's say that the course is called Course equal to by thin in Skillshare and skill share. And let's type. No, not type print, excuse me. Course. We will get on the terminal Python in Skillshare. And you know, now if we want to make it as DEP apostrophe is part of it. We can do so. Now, how to do if I want to write a lot, a big message, for example, I want to write Python. In Skillshare is one of the best courses, please. Oh no. Let's remove this and let's try it. What you want to say. Python is for equity. What Python on skill share is the best. Hope. You are. Enjoying it. To move. Okay, thank you. Thanks for your help. How we do this? To do so, we have a technique that's called the double quotation. And here, the double quotation, excuse me, triple quotation one. And this one. It's not working, okay. Would also this one. And here, if I want to print course, he will print it as I want to solve. If I want to make here a tab and print the tab will appear. If I want to make here a double-tap, the top will appear. Also in this section, we will learn a technique about the strings. I will remove this and let's say course equal by fin on Skill Share. Now, let's tell Python to print course. However now I want to make like brackets, excuse me, brackets and just press the number 2. Let's see what he will print. He will print the letter t. Now if I want him to print the latter one, here, we'll print the what? If I want him to print the P? I have to start with the 0. Now I can let Python print me a part of it. For example, I went from 0 till six. Let's see, Python from 0 till six. If I tell him from six till nothing will print after six, he will not take six and then move on. He will start excuse me with the six with this base and then move on to the to the end of the knee. Let's do a small exercise. I want to make a range and you have to guess what I am asking or what Python will print on the terminal. Can you address it now? Please? Take some time. He will takes the on. Now let's say from ten till 15. Skill. What if I want to know the number or the length of the Python sql? What I have to do is I make a print. There isn't a built-in function called length. The length of the course. This is very essential. And I tell you why it is essential because sometimes when you are signing up or creating an account on a website, you press a password. In this password, if it exceeded, for example, 20 letters, it will reject it. Now, we can make an example or a project about using this land. If it exceeded this type of this number of letters, you will be rejected and asks you to input your password. This is important and this section of websites, and you may find it in other in other areas. For example, if you are putting your name in again, et cetera. This is for the strings. Let's move on to another topic. 9. Strings Methods: Now let's move on to the strings methods section. It is a very interesting and nice part of the scores where we can manage and modify their strings to be changed, to be modified. That's it. That's remote. Remove what we have. Let us repeat course equal Ethan. For Beginners. Then let him put int. Okay, lets me before letting it print, let's tell you what the meaning of the strings methods. Once I put the dot, I get a series of methods where the Python is able to change or modify or manage with the strings. For example, lowers blood index, find upper, et cetera. Let's start with the upper method course, dot-dot-dot, then execution, as we said before, let's print what we will have. Course dot-dot-dot and run Python for beginners or an upper lateral. Let's change it to lower. And check Python for beginners or the lowercase. However, the method does not change the original statement in the string. For example, if I leant the print, course, I will have nothing to worry about. Python for beginners, as in the lowercase and Python for beginners in the original case. Let's try another thing that, that is the fine. But before making course dot find, I have to explain some, an idea I'm missing in the previous section. If I asked bifan to print course, and in the range of minus one, he will print as the last one. If minus 3, it will print the letter E, The third one from the final side. Now you will understand why I explain this topic before explaining font. Let's print course dot. Find. What we want to find. We want to find the strain letter P. Let's run it. Excuse me. What's giving me oh, okay. The line five I'm not writing. I'm writing nothing in the line file. Okay. He gives me an index 0. The method find, let you or finds the latter or anything you are searching about by index, by giving you where it is in the statement. Let's try for t index 2, 0, 0, 1, 2, 3, 4, 5. And I will make a dash. Now, I will tell you what the meaning of this dash. Okay, let's see now, for letter y and check it is one according to this, this the window like I, I call it as known as or the hashtag, is just telling Python this is a detail or an OT. Don't run it, don't read it. Just scratch. I won't put anything. For example, here, I want to write for the user, print core, Python. For beginners. In course. That's easy. Just an OT for the one who is writing the fourth one was reading the code. Now let's try another thing. If I want to course dot find P in the lower latter, I will have minus1. Minus1 is not an index that it is in the ending or the last letter in the statement. That's why I explained the minus1 and strings. It is different than the minus one in the fine because find it's telling me minus1, like it is negative, there is no letter P and the lowercase, because The method find is case sensitive. It can be sensitive to the upper and lower latter. Let's retry and P, it will get it. If I hotel to, for example, the US letter, he would not tell me minus1. He will show me the number 19 and the index 19. Let's move on to a very cool method that is called the Replace. Of course, dot, replace and replace. I have to tell him the old and the new. I want to replace the letter B. Come up with the letter J. And let's try it. Jonathan, for beginners. If I want to, then print course. I can see that it didn't change, that replace or any other methods does not replace or affect the initial statement. Now, let's see in the operator, if he finds the whole, Let's try another method called find. I'm asking him to find unexpected x, excuse me. Okay. I forgot to make a parenthesis. Who will tells me 0? He found python starting from the index 0. For example, if I tell him beginners, let's check here will tell me 11, starting index 11, we will start with beginners. Now I have a command or a section called the M section or the increment. It is, it resembles defined. However, it is different. It resembles it only. So if I want to tell Python, can you find Python course? And let's run it. Of course. I have to make a command that prints it in Python in course. And let's see what we have. We will have a true four shoot. The end command is a Boolean expression because it returns a Boolean value. For example, if I told him print bifan with a lower letter, in course, he will tells me false, it is not present. That's how the in command differs from the dot, fine, because the DOT 5, Let's put hint, hint. Of course, find the latter, the word Python. And let's make Python here. We'll get a true and the int command, however, we will get a 0 and the dot Find command because the fiber gets the index and the end gets the Boolean value, true or false. I hope you enjoyed this section. Let's move on to another one. 10. Arithmetic Operations: Now, with the arithmetic operations, the arithmetic operations, like every computer language, there is built in operations that are arithmetic corresponding to the mathematic operations included inside the Python language. And as we know that numbers in general, and especially in Python, are divided into two classes. The integer number such as 1024 and float numbers such as 3.664.98. That's why I wanted to show you how to convert from one type to another type and how to see other arithmetic operations inside these sections. For example, if X equals to 10.5, let, let's say X1 equal int x. What would happen is the following. Print on the terminal x1. Let's see what we would have. Who would have ten because it will remove the fluid none. I will also make 10.6 to see it will stay tan, it will not round the rounding, it will be in the operator procedures and the math functions. We will arrive to them. Also, I wanted to show you the basic math or arithmetic operations included in Python. We have the plus, the minus the multiplication, the division. We have special division and we have the modulus, also the power or the exponential. For example, let's say x equals to ten plus 4, then print x. We will have on the terminal, 14 should ten. Let's make the minus 410 times 440. Now we arrive to the division. Let's say I have 10 backslash divided by 4, I will get 2.5. What if I put double slash? Let's try out. We'll get to, because it will take only the integer part. For example, ten divided by three. I will get three because the answer is 3.33. Let's see as the simple division, it will be 3.33, etc. Now let's adapt to the modulus. The modulus give me what is the rest of the division? 10 divided by 3 equals 9. 3 times 3 plus 1, the remaining 20 modulus 3. We'll have to also have the power and, or the exponential. We refer to the exponential or to the Power BI, let's say 10, two stars, two times, it will be 30, it would be 110 to the power of three. Also I have, in this section, I want to show you two basic or two different concepts in the augmentation or the incrementation. What do we mean by incrementation? Let's say x equals to 20 plus 20. Then we said X equal 20 plus 20 plus 4. And ask Python to print acts. For sure you will print 20 for the second one. Now we have a technique, this is the incrementation. We have a, an enhanced technique called the augmentation. And this is essential if you want do if loops and for loops or receipt and other projects and examples, that augmentation is more advanced. It is better to use the augmentation technique. We said ax plus b equal 3. This formula. It is the same as x equal x plus 3. This is the same. The plus equal refers to equal x plus. That's why I will remove this and ask him to print acts. For sure he will print 23. By this, we finished the arithmetic operations section. 11. Operator Precedence: Now arriving to the operator precedence section, this is not concerned with Python or any other languages for programming. It is a basic math concepts and like it is for all operations, all applications, et cetera. The operator precedence will be explained more with an example, let's say ax equal 10 plus 2 times four times four. What will happen is Python will not read it as ten plus two equal 12 times four equals 48. It will follow the true mathematical procedure as to start with the multiplication before the addition and two times four equals 810 plus eight, it will be equal to 18. Thus, if I ask Python to print acts, he will print it as 18 on the terminal. And the same if I did the division, however, I want four divided by 210 plus four divided by two equal to two, then it would be 10 plus 2. I will have 12 on the terminal, 12 plus 0 because I used the division command here will give me a float numbered, is that often integer number? This will be the same if I did the multiplication with the exponential. Exponential. For example, if I ask Python to print x plus 2 times two and exponent of two, what will happen is it will start with the exponential part 2 to the power of 2 equal 422 times four equals 810 plus eight will be 18. That's correct. So what we will have as the priority, Let's give it to remind you with the announcement or the note. York City, it will be one for the exponential. 2 would be for the multiplication and the division. And the number three would be for the plus and for the minus. I wish destruction was helpful and please do not make these mistakes. It will show you that you have some lags in mathematic concepts. Unfortunately, I taught different students from different backgrounds Python languages. And once we arrive to the arithmetic operations sections, we fall in this problem. It is a common mistake for students. I don't know why. Now let's move on to a very interesting topic, the math. 12. Math Function: Now with the math functions section, and this section we will learn how we have some functions and built-in functions, how we import models concerning the math and mathematical operations. Let's assume that we have AX equals to 4.7 and ask Python to have the round, the rounding of Acts. And then a Piton, this rounding, print, rounding of x. Or what you will have is for sure five. And let's now put it 4.3 and we will have four. Also, we have another function, a function that is the absolute. Assuming four is a negative number minus 4.3 and ask Python to print the absolute of x. Let's see what we have. It will turn it always a positive number minus 6, it will return it as a positive 6. Now, these are very basic mathematical operations and commands. However, sometimes we have some complex operations and we need, for example, tangent, cosine, etc. All these can be found from math models that these models are built in inside Python. For example, if I add up to a supermarket and I have white friends stuff, I have different sections. For example, on, for the vegetables, 14 candies, et cetera. These are models in Boynton will have different modules and the math model is one of them where we can find all these mathematical operations in order to use them. These are pre-built and inside Python in order to import this model and use it in the window you are, we are working on, we import math, just this. We will have it in a gray color. Thus, we will last floated, right? We have to pay attention that it will be, it should be all in lower case. And in order to use it, we have to use the math dot and we have different functions. A cosine, sine, cosine tangent floor. See, let's check what the meaning of the seal function. And let's see math dot ceil of 4.9. Then print the answer on the terminal to see the seal for sure will be five. We will have five on the terminate. As we can see, the opposite of this field technique or the seal method is the floor. Let's see, we will have fought. There is a large number of functions inside this model for you to find all these commands and application in this mode, all you have to do is to go to your browser and press Python three, modern math model and press Okay, we got to the Python 3.9.6 documentation and we can see a very large number of theoretic and the presentation functions. We can see the description of each one and how to use it as an exercise. At the end of this section, I advise you to go and see some of these functions and try to Stan and the bifan. 13. If statements: Hello everyone. In this video, I will be showing you the if loop section. This is one of the most important sections in this course because it shape other programs. And you will see how in case you would continue this course and you want to do the project. It will be very useful for your project at the end of this course and for the continuing of the Python course on this channel. Let's start with directly as an exercise. If I want from Python to print a program according to the following. If the weather is hot, that the user that the weather is hot and drink plenty of water. Otherwise, if the word, if the weather is called, tell the user that there was a scald and where would cloth otherwise tell the user that it has a lovely day? And finish your program with Enjoy your day. Let's start with the first section. For the effluents, I plus I have to define. First is hot equal true? That is a Boolean value. Then if it's hot, I will have an indentation here. And then expected after the if, because F is hot is true, it will directly apply what is inside the indentation. I press Print and quotation mark goes, I want to use an apostrophe. It's a hot day. Then trend. Drink plenty of water. Let's try. Is hot is true. He printed on determinant. It's a hot day, drink plenty of water. However, we ask the program to finish your program with Enjoy your day. If I like this, print, enjoy your day. It's a problem because in all cases, if it is hot, if it is called or it is a lovely day, they enjoy your day should be done. However, when I put it inside the indentation, I'm asking Python to print enjoy your day only if it's hot, it's done. So in order for us to make everything clear and to print, enjoy your day in all conditions. I have to make it as an alone statement with an outside and then let's continue and put otherwise, if the weather is cold, now, I will make the hot folds and lets, the otherwise is represented in Python was IF else, else print. It's a cold day. Print where we are. And let's run it. It's a cold day where it would close. Enjoy your day. I will show you why you cannot do this, because I wouldn't move this from here. And let's run it in case is hot as folds enjoy your day will not be shown all we have to put it in each and in each case. No, that's not That's not good at all. The repetition. I wanted to give you an advice in Python, please avoid repetition because now we are starting with small programs. However, if we want to continue with advanced courses, you will see that Python should be very clear cut in models and dissections and everything should be the minimum. Let's get it back here. Now, he is asking me otherwise, tell the user that it is a lovely data. Now I cannot do this with two analysis. So what will be done is we will define a new condition is called an asset equal false. Remember the false and the true, The Boolean expressions should be in the capital letter. Then the otherwise is represented by F and F visited, presented by F. We have a term for the ALS called LF. It means otherwise f. Then we define. New else and print it, say lovely glow. And let's, let's run it. Lf, excuse me. Excuse me. Lf is called. And now it can be wrong. It's a lovely day. Enjoy your day. Let's change a scald through and it's hot, false. It's a cold day where would close in case this was true. This is false. It's a hot day. Drink, drink plenty of water. Now I want you to do a small exercise. What will be done as the price of the car is $100. So we remove all and define price equal $100 thousand. Empty costumer has good credit, make a $10, a 10 percent discount. Otherwise, make a 20 percent discount. And I want you to print the down payment that the final pavement at the end of the terminal. So let's start. I have to make the condition has good credit equal true. So if this tried to do it yourself, it is very direct. And then see if the solution, you can pause the video. If has good credit, we enter payment equal price minus 0.1 times price. Then adds payment equal price minus 0.2 times trucks. And at the end, print. And I will use a formatted string. Your final payment is payment. Let's check that everything is okay. 100 thousands for this. And your final payment is 90 thousands because the has good credit is true. If it's false, let's check. Your down payment is $80 thousand. However, we didn't put any dollar sign. Let's put it here for the indentation, the dollar sign and see what's happened is $80 thousand. I wish you were able to solve this example and see you in a new topic. 14. Logical Operators: Now we arrive to the logical operators. Tutorial. This logical operator is used in case we have multiple conditions. For example, if an applicant has high-income and good credit, the bank will tells him that it is eligible for long. If you are asked to do this program. Firstly, you have to define has good income equals to 2. Done. Good has, excuse me, has high income, has good credit equal true? Then in this case, the applicant, the applicant is eligible for the loan, print illiteracy. For an eligible for a loan. Excuse me. How to make now the condition. So we tell him F has high income and not God's has good credible and function, has good credit. You print, you have to put the print inside the indentation of the F. Let's try it now. Eligible for a loan in case I change only one, I will have 0, I have nothing. That's why if you want to do, if you want to ask Python to have just one condition, has high-income or has good credit. What do we say false? And we change and to off, the old function will do the same in case I make them both false. I will have nothing on the terminal because in the ord function, I need at least one condition that it is true. So as a note, the ENT mean both the or means at least one. And I have also on that is called the NOT function. I will tell you when we use NOT function, let's assume that the bank does not it is not interested in good credit and the only other condition is has a criminal record equal false, and has good income to how to tell biofilm that this force is now needed. I don't want him having a criminal record. I need the criminal record condition as a force and not both of them true. So what I have to do is if has high income and not has criminal record, print eligible for a loan, what will happen here as the highest high-income is true and Python is waiting for a true condition. So not, we make like a negative and the mathematical operations, it will reverse it. So not, it becomes false and the has a criminal record will become as for Python as an eligible condition. So he is printing me the loan. For example, if I press here through, I will have nothing. If I press here false, I will also have nothing. Now, let's extend this program and ask Python in case. This case was not, was not achieved, print, not eligible for loan, trust, for not making the terminal always as a free terminal without writing anything. And by this, we finished the logical operations. Let's move on to another section. 15. Comparison Operators: Okay, now arriving with the comparison operators section, this operators compare a parameter with the value. And the previous example we said if it is hot is true, we compare it. We put it any condition of a Boolean value. If it is hard, if it is called f, it is neither this or this. It will be a lovely day. I will repeat the same example. However, the conditions are with values. Let's assume that if temperature is greater than 30, that will be called. And I will, on the print on the terminal, it's called, it's a hot day. Drink plenty of water in case the temperature was below time, it is a cold day. We're good globe. And in case neither this or this, the temperature at that announcement will be, It's a lovely day. Enjoy your day. Let's first define a value, a variable call temperature. And let's say temperature equal to 35. If temperature greater than 30, we will have Brent. It's a lovely day. Then print, drink, plenty of water. Now, if temperature is lower than 10, put in it's called the where clause. And then else. Shunt. It's a lovely day. And at the end of everything, trend, enjoy your day. This is the same program that we did last time, however, with values with a comparison operators rather than just logical operators. Now, I want to introduce the comparison operators for you. Here we used greater and lower than. However, we have a greater or equal. We have the lower or equal, we have the greater alone, we have the lower alone, we have the equal sign. The equal sign is a double equal because in case you give Python just funny, he would make like a red mistake. Read the other, there is something wrong because the one equal, it is just an assignment statement. It does not give a Boolean value. The condition we said before that it works according to the Boolean value. So if temperature does not, if this condition does not give true or false, it will not run the program. And thus, in order to make it as equal, we have to make w equal and we can use the not equal. And this is referred with exclamation mark and equal always did not end. Bison is referred with an exclamation mark. Let's do if it is greater than 30. And let's run this simulation. It's a lovely day. Let's make it as at 25. It's a lovely day. Okay. Now, I will make it a little bit more. See, let's say I want to, to insert the temperature. So I'm asking the user to answer the temperature. And according to this, I will print statement. So what we will do is we will change the direct value of temperature and make input. What is the temperature? Now? And make a space. Okay, let's see what is the temperature now. Let's see if the program will give me an error yes or no. And run, we have a track back. The greater is not supported between instances of string and integer. We said before that the input is a string. So what we have to do is temperature. I have to temperature equal integer temperature. And now let's stop. What is the temperature now? It's 35. Let's run it. It's a lovely day. Drink plenty of water, and enjoy your day if I'm a deal on it and asking him what is the temperature at it is 16. And it's a lovely day. Enjoy your day. What this conditions if you did not understand this exercise application fully, please repeat this tutorial because I'm asking you a very nice project. It's small exercise, that's not a project. I want you to do a program that if the name is less than three characters long, it print on the terminal noise, name must be at least three characters. Otherwise, if the name is greater than 50 characters long, the name can be maximum of 50 characters and otherwise, name looks good. This is a simple exercise. However, I will give you a small trick or a tip. Use the length function that we learned that in the beginning of this course. It is referred to as algae and, and the parenthesis. Try doing it yourself. Please stop the video now and see my solution and correct yourself. Don't directly go to the solution. Please. Go to the application and we tried to remove the terminal. Let's define a name with a string, call it Skill Share. Then may start making the condition. If length of the name is smaller than three, print for me, name must be at least three characters. Alice, length of name is greater than 50. What we'll have is length of greater than 50. It's not working. Okay. Last name is a greater than 50. I will run it as an indentation parent name, and that's printed. Name can be maximum of 50 characters. Then close the quotation mark and start. Then else. We run it. Print name. Looks good. Then we close the quotation. And by this, we finished this example or this exercise. Name looks good. Let's try and change the name. Alex, skill share Apple, et cetera. I'm just trying to make it above 50. And run. Name can be maximum of 50 characters. And in case I did it with just me, and let's run it. Name must be at least three characters. Now let's try to make it more spicy as we started before. And I'm asking you to input your name and in case it followed the and according to the condition, it will print for you anything on the terminal. So let's define name equals to m. Put, then insert your name with a space. And then like this, Let's run it. He's telling me that there is a problem concerning the input. And it is that we don't have a string. Now it's done. Insert your name. I will press highly and press Enter name. Looks good. Let's retry it. Skill, Share student, and let's run it. Name. Looks good. For the final time, I'm going to try like a just two letters WE and enter. Name. Looks good. That's a very large problem. That's what I'm going to repeat it. And trust WE name must be at least three characters because once I put the space etiquette as a character because it's a program. Learn what you have. Do you want it to make? Do you want me to make it more spicy or let's keep it simple as this. Let's try. What if you put an aim of two characters? It's done. You don't put your name anymore. The program should really ask you about your number. So what we will have is we put in case the condition was not, was not found, we have to repeat this name input. And by the Tau, we put name input and let's run it and search your name. If I'm telling you, WE name must be at least three characters. Insert your name. Let's change it and make it more professional. Insert your name. And by this, we did the right thing. The same for this layer, this section. Now you have a very professional. Let's say W name must be at least three characters, reinsert your name. And then the process is finished. By this, we finished this exercise. Let's move on to another section. 16. Project: Hello everyone. After finishing this small NDC course of Python for absolute beginners, and after teaching you all basics in order for you to start your way in Python. As a beginner, I want you to do a small and easy project. I chose to not make it as challenging and hard because you are just absolute beginners. And the other end, the continuing courses, I will make you some very spicy and challenging projects. What I want you to do is to write a program that asks you the weight of the customer and the unit. Then Python, you should convert it from kilograms to pounds or from pounds to kilograms, depending on which unit you inserted your waiter and then printed on terminal for you to understand more and make it clear because please try to do it yourself without directly going back to the solution. Do it, it is very easy, it's doable. I will try to run it. Here is asking me my weight, let's say 160 for sure it will not be in kilograms, it would be in pounds. Whether I pretend a small l or a large Al, he will give me 72 kilograms. I will rerun it and try to put him to tell him in kilogram, Let's say k, you are 160 pounds. By this very small project, it will not take more than 10 minutes with you. Please try to do it. And this is also my contacts for you. If you have any question, if you want to send me your project, if you want to know more about anything you made a mistake, you didn't understand the solution, anything you want, feel free to contact me through my main my phone number. If you are outside Lebanon, you can speak or you can chat with me through WhatsApp Telegram. Also, my LinkedIn link is in front of you. I wish you enjoyed this course. Good luck with the project and please do it right. You are, you are able to do So. Good luck. 17. Project Solution: Okay everyone, now let's start with the solution of the project. We know the project was very easy. It was just for the application. I didn't want you to give a challenging project because you are absolute beginners. And we did many exercises that were very interesting. And in case you were able to solve them, you are, you are ready to continue with Python in other levels. Now the project asked us to write a program that asks the customer or the user off his weight and in which unit is in putting his weight. And then the program should convert it from kilograms to bounce or from pounds to kilograms according to what's being done. Then he should print it on terminal. Let's start with the program. First we have to ask, the user, will have to define the weight value that it is the weight of the customer or to use weight equal than we are used to put an input than strings, wait to point and then make it space to make a value. However, there is a, there is an error. We are advanced in this section and the string section, we know that the input section is, we'll return a string. However, the weight I wanted as an integer number from the beginning without putting any errors or making any mistakes, let's turn it into an integer number and continue safely. Now, let's move on. I want to ask the customer or the user about the unit. So our defined another valuable that is called the unit and r1 equals then input. And put the apostrophes to start the strain and ask him. Right? And four pounds and k, four kilograms or insert. Now, let's move up. Unit input, kilograms. I have to finish down and parenthesis. And we are done. We are asking the user has weight and the unit in which case inserting the weight of S. So let's start with the f function. If unit equals, equals, so it contains the letter L. What you will have to do. We have to convert the number, however, what, what assure me that the user will not insert a small l. What you have to do is we will use the strain methods that we learned in this course. If you forgot them, please go back to the beginning of this course, check the strings, strings method, and you will see that unit dot upper. If this contains the latter. Than his, meaning, the pounds unit, we can use converted weight equals to the normal weight times 0.45. Then you have to print your, you are then converted weight. This converted rate is from past, so you are converted weight kilograms. Let's go back to the else command and the else command, the converted, excuse me, convert to a weight to weight, the normal weight divided by 0.45. And I remember that this division, you produce a float number. If you want to return an integer number, you'd go back with the double backslash. I will stick to the float. Then print a formatted string and you converted weight bonds. Let's put on it. What is your weight? Let's say 160, for sure, not kilograms. That will be in pounds. However, there is something ground insert large. For speed. Stop entry, run your weight 160. Insert L four pounds and k four kilograms for short pounds, you are 72 kilograms. Let's try and repeated. My weight is 70 to 72 kilograms is in kilograms, you are 160 thousand pounds. By this, we have finished this project. I know it was very easy and simple. You learned everything in it and nothing was a new or needed for research or trying everything. Everything was previously done. In this course. I wish you enjoyed this course in case you have any question, you have. My contact and the beginning of the course and the end of the project introduction, a CON, the next course, if you are willing to continue with Python called Python for beginners.