Transcripts
1. Python for complete Beginners - Introduction: welcome to Python programming for complete beginners. I am delighted to welcome you to the course before I tell you by the course itself. Let me tell you a little bit about myself First, my name is fibrous. I am a full time technology teacher in an international school and I love teaching. I started my career in Europe by I'm currently working in Surface Asia. In this course, you will learn the following how to install python on your computer, how to use the path and user interface. What I meant by this is how to get started. Once you've downloaded python on your computer and 10 key programming concepts at the end of the course in the class project, you will create a phone queries on the topic of your choice putting into practice those 10 key programming concepts. I hope you're as excited as I am. Let's get started
2. How to download and install Python: welcome to Lesson one. In this lesson, I will show you how to install python on your computer. To do, sir, we need to access the following website. W w w dot python dot orc Let's open a new Internet window and typing. Www dot python dot book Press return on your computer. This is the Python website. As we want to download Python, we have to select downloads. As you can see, I'm using a Mac download for Mac or US Python 3.7 point Earth. This is the latest fashion off python. If you're using Windows on a PC, you will see the following window. Instead. Download for Windows Python 3.7 point. Oh, please click on python 3.7 point her to stop downloading python. It will take about a couple of minutes to download python on your computer. If you're using a Mac, the easiest way to find by Thin is by clicking on the downloads folder and python will be listed here. If you're using a PC, you will need to locate Python in your applications folder. Double click on python and the following window will come up. We are now going to install python, click on, Continue, continue and continue again. I agree. And then install. You may need to enter your password and then install software installing the software installing python will take about and men it'll too. At the end off the installation, a new been double come out showing all the files that have been installed on your computer a few more seconds. This is the new window. As you can see here, all the files that have been installed on your computer the only file that we will use for this course is the python idol or python. I d l e This the end off lesson one in lesson to I will show you how to use the python idol . Please don't look python and install python on your computer now See you in lesson to thank you
3. Understanding the Python user interface: Welcome to lesson number two. In this lesson, I will show you how to use the python user interface. What I meant by this is how to start using python. Once you've done loaded python on your computer at the end off lesson one, we finished installing python on our computer. And here are all the files that were installed. The only file that we will be using its the Python Idol or Priceline I D L. A. Please double click on this file. A new window will come up. This window is called the Python Shell Python 3.7 point shell. Let's start entering our first program, please Typing print often break yet speech marks. You can either use a single or double quotation marks. Hello, speech marks in close brackets. If you use single speech marks, you have to use a single speech marks after hello as well. If you use the double speech marks, you have to use double speech marks after hello Press return on your computer on. As you can see, python will display the word. Hello. The problem with the python shell is that you can only have one line of off occurred at a time. Every tramp you press return on your computer by thin will run or execute that line of Kurt . If you want to work right of program that contains more than one line of curd, we have to use a different window. Please click on file and new file. As you can see this time, this window is not called shell, but entitle, we will give a name to this window late on. Let's enter the same sentence print open break at speech marks are personally tend to use double tradition marks of speech marks. Hello, speech marks, close bracket and press return. This time, nothing actually happened. Let's try entering a second line. Print up on bracket tradition marks. Uh, how are you? Benchmarks and close brackets Press return. As you can see, nothing happened if you want to run this script. If you want to execute this program, you have to click on run and run module. We have to save the file. First click on OK, I'm going to call that python into face and then save it. As you can see this time, python will display Hello, How are you? Together you can add as many lines off code in that program here, and when you run the program, they will appear together here. This is the end off. Listen to let's quickly summarize what we have learned in this lesson about the python, the user interface. When using python, you are presented with two options. You can either use the python shell, but every time you press return on your computer, python will run or execute the program, and your program can only contain one line of code. Or you can open a new window by clicking on file and new file, and then you can enter as many lines of code as you want. When you want to run the program, you click on Brand and Run module. Thank you very much. This is the end off. Listen to see you in less and three, thank you
4. The Print Function: welcome to lesson number three. In this lesson, we will use the first key programming concept. The print function print function is used to display something on your screen. The good news is we actually use the print function earlier in lesson to If you remember, we used the following lines of code print. Hello, Print. How are you to run this program? We then clicked on Run, Run or Jewel, and he will display the result. Hello, how are you in the python shell window? This is something we used earlier, By the way, if you wanted to use a new by thin shell window every time you run the program, you can simply close this window and then click on the run and run module. And he will open a brand new python shell window, displaying the result off this program. Hello, how are you? Let's practice the print function on the next line. Let's try tapping in print up in bracket speech marks. What's you'll name? Speech marks? Close bracket. Let's run the program run running module. We must shake. Save the changes. Click on OK, and as you can see Hello, how are you? What's your name. This is the print function. The prime function is used to display something when you run the program. No common mistake made by students. It's usually due to typing errors. Let's try removing the question marks of the end off the sentence. After what's your name? Let's try running the program as it is, Right? Run module, Click on OK, this is some sort of error message. Simply click on OK, on. As you can see, I think it's telling us something is definitely wrong here. This red line here is telling us that there's something wrong on this line. What you will then need to do is double check everything, and hopefully you will be able to find the mistake on that line in this example. Obviously, I need to add the coalition marks of the end. I can then run the script and he will work fine. This is the end off Lesson three. Using the print function In the next lesson, we will use the next key programming concept called the Input Input Function, before moving on to the next video police practice using the print print function again, please see in the next video
5. The Input function and Variables: Welcome to lesson number four In this lesson, we will use to new key programming concepts but will use the input function and variables Now, in the previous lesson If you remember, we used the print function. The print function is used to display something on our screen print. Hello Print. How are you? Print. What's your name? When you run this program, it will then display Hello. How are you? And what's your name now? What would be quite nice is for me to enter To answer that question and to enter my name my name is fibrous And then for the computer to greet me saying something like Nice to meet you for Bris. Let me show you what I'm in. Don't worry about this program for now. Let me just run it so you can see what I mean. Hello. How are you? What's your name? You find typing my name for brace and press return Python is now using my answer My name Fibrous to greet me using my name. Nice to meet you for breasts. If I run the same program again, run module and they start defiant. A different Amy find John press Enter he will say, Nice to meet you, John. Now, obviously, the answer could be different every time. If you're under the question, your name will be different if somebody else and to the question, What's your name? It is very likely that their name their name will be different as well. Now let's go back to the script and let's have a look at the input function. You're already familiar with the 1st 3 lines of the program. The print function? No, because the question is, what's your name? I need to give a name to the input function and because the question is, what's your name? I'm calling the input function name. If the question was, What is your age? I will call that function age and the weight worked. His Linus, You give a name to the input function based on the question you actually answering in this case name, then space equals space. Then the word input on an open and close bracket name equals input up in a close bracket again. Just to make it clear, if the question waas what is your age? You will call this age equals input. Close brackets. If the question was. What is your favorite color? You will say color equals input. Open close bracket? No, because the answer will be different every time you ask somebody. What's their name is that the answer is called a variable. It means the answer will actually be different. The answer will vary or change every time. Hence the name variable. The input function is actually just storing or saving the variable so that the variable can then be used later on in the program. In our example, the variable name is used on the next line where the computer will reply. Nice to meet you for breasts. Nice to meet you, John. That value for breath John was saved thanks to the input function. Now the last line of our program we want to display. Nice to meet you. We know this from lesson three. We know that to display some text, we have to use the print function print open bracket speech. Mark. Nice to meet you and close speech marks because we want to use the value stored in the input function. We have to aunt at the end of that line. We have to add the name off the variable the name given to the function input. In our example I use the word name because the question was about my name and the way to do that. The way to combine a variable with the print function is by simply adding the symbol plus space and then the name off that variable hands this line print open bracket coalition Mark Nice to meet you. Coalition Mark Space plus space and then name If the question waas what is your age? And that the input function was called age. Age equals input Open close bracket The last line will read like this print Nice to meet you plus age. Now, as you can see, I've left us space here after you The reason being that if you don't leave that gap there when you run the script, it will say Nice to meet you, John on it would not leave a space between you and John. Let me just ring the run This script of this program again this run No duel. Hello. What's your name? Quite typing my name. As you can see, it is nice to meet you Space for brace. This is the end off lesson four before moving on to Lesson five. Please practice using the input function. Maybe try asking what is your favorite color and named the input function color. And then the next line will be print. Nice to meet you, plus color or what is your age? Age equals input. Open close bracket and the next line would read as print. Nice to meet you plus age. See you in the next lesson.
6. Strings and combining Strings and Variables copy: Welcome to lesson number five. In this lesson, we will use to new concepts strings, and we'll also learn how to combine strings with variables. If you remember in less and four we use the print function Print. Hello, Print. How are you? Print. What's your name? We use variable, cold name. We used the input function to sort store to save the name and we use the print function and very biblical name a straining eggs. Actually, something very easy to understand. A string is whatever you put in between quotation marks. So the word hello is a string. How are you? Is a string? What's your name is a strain. Nice to meet you is also a strength. Now we know that nice Dimitri is a string. We also know that name is the variable. So actually, in the previous lesson, we already combined a string. Nice to meet you with the variable name. Let me show you another way of combining strings with variables. Let's I assume I want to ask the person What's their favorite color is so print open bracket tradition. Mark. What's your favorite color question mark? What should mark close brackets Press center now if I want to store. If I want to save that value, I need to use a variable because the question is, what's your favorite color? I'm gonna name that variable color space equals space and then the input function input opened. Open close brackets. Now let's assume my favorite color is blue. What's your favorite color? My answer will be blue. It would be nice if the computer computer called Reply, saying, Oh, blue is also my favorite color or I like blue to This is my favorite color, too. No, we will use the print function open bracket question mark for really space. What I should mocks space plus color space plus class Quotation marks is also my favorite color quotation marks and then close brackets. As you can see, I am combining a number off functions in on this line the print function. A string variable called Qala Onda. Now the string is also my favorite color. To combine a string or strength with variables, I simply need to add the plus sign before or after the variable. Let's run this program and see what happens. Run run module. I need to save it. First click on. OK, hello. How are you? What's your name? Fibrous. Enter. Nice to meet you for bris. What's your favorite color? Blue press return or really blue is also my favorite color. As you can see, there's a slight problem here. There's no gap between the answer between the variable and the word is I need to go back to my script and fix this. I need to leave a gap just before the word is they go. Or really? Don't forget the gap here before closing the the square back things. Question marks space plus space color space plus space Coalition marks Space is also moderate. Favorite color coalition marks and close bracket. Let's run the script again. Run, run module Save changes Yes. What's your name for breasts? Nice to meet you. For bris. What's your favorite color? Blue press return. And this time, as you can see or really, blue is also my favorite color. No, I can. At as many strength of variables that I want. I would actually add more things here. It really depends on the question. Ask Previously in this case, it was about your favorite color. I'm sure you're starting to realize now that you could actually ask a number of questions and then combine a string with a variable. If the question was What is your favorite painting? You will call the variable painting space, Equal Space Input Open close bracket. And then on the next line you could say something like Print or Really Space Coalition Mark Space plus Space Painting Space plus Spain. A space quality mark. Space is also my favorite painting. This is the end off lesson number five. Before moving on to the next lesson, please practice using the print function, using variables and combining strings with variables. Again. If you run your program and you get a red line well, some error message. You need to double check every line. As I mentioned previously. A common mistake is typing errors, forgetting something for getting the to close the bracket at the end of the line for getting the coalition marks and so on. Please keep practicing. See you in the next lesson. Thank you
7. Data Types and Boolean Operator: welcome to lesson number six. In this lesson, we will look at two new key programming concepts data types and Boolean operator. Before we move on to these two new concepts, let's do a quick summary of what we've covered so far in the course. In the previous lessons, we'll use the print function print. Hello. The prin function is used to display something on your screen when you run the program print Hello will display the word Hello when you run the program. We also used variables. In this example, we used a variable called name as we wanted to answer the question. What's your name? Variable is used to store or save a value. We also use the include function. The input function is to let Python know that you will type in on answer. In this example, I will type in the answer to What's your name? And that answer will be stored or will be saved in the variable called name the print function again. A string Remember a strings, anything that you put in between quotation marks, by the way, a string should appear in green. Combined with a variable. Remember to combine a string with a variable, you have to use the plus sign the print function again with a string another variable ical color Andi input function again to let Python know that I will type in the answer to the question. What what's your favorite color on? I walk my answer. To be stored or to be saved in the very biblical color. And finally, on the last line the print function again with a string combined with the variable combined with another strength, let's have a look at the two new concepts. Let's start with data types. When it comes to numbers, there are two types off data types. The first type is called an integer. An integer is the hole is a hole number. For instance, the number three, the number 57 or the number of 1007. These are inter jizz in python. They are whole numbers. The second type of data type is called a float. This is a decimal number. For instance, 3.57 is afloat, 65.43 is afloat. 544.67 is also afloat. These are the two types of data types. When it comes to numbers in python. Let's move on to the next part of this lesson. Boolean operator. The bullion operator will only accept two possible values for instance true or false? Yes or no? Let me explain what I mean by this. If I asked you, Do you have blue eyes? The answer is a Boolean value. There are only two possible answers either. Yes, I do have blue eyes or No, I don't have blue eyes. If I ask you, Do you understand the meaning of Boolean again? This is a Boolean value. The answer can either be Yes, I do understand the meaning of Boolean or no, I don't understand the meaning of bullion So brilliant Operator will only accept two possible values. This is the end off Lesson six In our next lesson, we will use conditional statement in caisson. See you in the next lesson. Thank you
8. Conditional Statement Part 1: welcome to lesson number seven. In this lesson, we will use a new key programming concept. The conditional statement. If else the first thing we need to do is to open a new python window, please click in the window we used in the previous lesson and then click on file and new file and new window will come up. No, we are going to start making a quiz. Let's assume that if I choose the number one, I have to enter the following question off our quiz. What is the capital city of France? If I choose to, I will have to answer a different question. What is the couple Capital city off Italy? No. Let's have a look at how the if else statement actually works. I'm going to use the print function first Print. Open bracket. Question Mark. Please choose either one or two traditional art class bracket now because I want to save the number I need to create a very vocal number. Number on their space equals space input. Open close bracket. This is something we use in our previous previous lessons. Press return? No. If I choose one python should display What is the capital city off France. If I choose to, Pathans should display what if capital city off Italy. So if if the variable number space and then we have to use to equal signs equals equals space coalition Mark one question mark and then we have to end the line with the Kahlan. So if space number space equals equals face, coalition marks one position marks Kahlan, press return The reason why we have to use two equals It's because of the if statement. As you can see, the cursor is not at the very beginning of the line. This is normal. If number equals equals one, we want to display the question. So hence the print function Print open bracket. Question Mark. What is the capital city off, Frantz, What should mark close bracket please place the crest at the beginning of the next line. Now the reason why we have to have this gap hair is to tell Python to Onley Run this line if number is equal to one. This is the reason why we have to have that gap here. I'm going to repeat this. The reason why we need to have this gap here is to tell Python to only run this line. Print. What is the capital city of France? On Lee? If number is equal to one, if number isn't equal to two else or otherwise, if it is equals to two, I want to display what is the capital city off Italy. So we cannot use the word otherwise in Python. But we can use the word else so else and then column again. Press return. So and then the print function. What is the capital city off Italy? Question marks in brackets percent Place the cuss at the beginning of the next line. So let's see what happens when I run this script. Run running on you. I'm going to call that Faison Quist. Click on Save and let's see what happens. Please choose either one or two that press one. It should display the first question. What is the capital city of France? Perfect. I'm going to close this window and run the program again. Right? Run module. This time I'm going to choose to and shoes display the second question. What is the capital city of Italy? Perfect. No, As you can see, this is the beginning of our Chris now the problem with this program is that if I run it again, But this time, if I make a typing error and I enter, let's say three instead of one or two and press return, it will actually display what is the capital city of Italy. Let's close this window. The problem with the if and else I felt cannot understand what I mean. If I make a typing error, if I do not enter one or two, it will automatically display the question. The string after else. No. To fix this, we have to add a couple of lines of code. This is something we will do in our next lesson before moving on to the next lesson. I would like to practice this. Try entering another question. Try using the if statement again and maybe instead of one or two, choose three or four and then if number equals equal. Three. Print. What is the capital city off on Spain else pranked but its capital city off Germany, for instance. See you in the next lesson. Thank you
9. Conditional Statement Part 2: Welcome to lesson number eight. In this lesson, we will carry on using conditional statements. If you remember in the previous lesson, we use the following statement if and else this is if you only have two possible chances in our example, we actually have three possible answers. Liken either typing one or two or something else if I make a typing error. And I demonstrated earlier in the previous lesson that if I choose three Python will display the question. What is the capital city of Italy? So to fix this as we have more than two conditions, we have to add something to the if else statement. No, Place the cursor before else please and press return a couple of times because we have more than two conditions. We have to add what we call Elliff E l i F. So when you have more than two conditions, you start your conditional statement with if and then Elif and else at the end, Let me show you how it works. So l f so everything number is equals. Equal to third equals equals space. Question mark to coalition. Mark Colin, Don't forget the column at the end Print on bracket Question. What is the capital city off easily? I'm going to move this up now. If number is equal to one, Python will display what is the capital city of France, Ellis, meaning If number is equal to two, Typhon will display what is the capital city of Italy else? Many. Otherwise, if it's not one or if it's not, too Python should displace some sort of error message something along the line off. Please only choose one old to let me run the program to see what happens when I run it. Run running audio. Okay, this time, if I choose three, I will see the error message telling me that I must choose either one or two. This is the second part of the conditional statement lesson. No, If I had more than three possible answers like in this case, it can either be one or two or something else. If let's say it was, please choose either one or two or three. I would need to add another LF after the sip after the first LF so I would have Yes. LF LF else it will look something like this Oh three. I would then at another. LF number equals equals three Colin Print What is the capital city? Oh, Germany. Close brackets. So what if I run this program as a test? If I choose one, it will display what is the capital city of France. If I choose to, it will display what is the capital city off Italy. If I choose three, it will display what is the capital city of Germany On it. Fight. Enter something else. Let's say fall. It will remind me that I must choose 12 and I need to change this to or three. This is the end of the lesson on conditional statement. In the next lesson, I will show you how to add comments to our Chris. I will also show you how to add another if within an f. We currently have a kind of beginning off a crazy here. But what would be quite nice if that if I choose to born and python display the question What is the capital city of France? It would be nice if I could then enter the question and Python would tell me whether it is the right and it's that or not. This is something we will cover in the next lesson. Thank you. See you in the next lesson.
10. Conditional Statement Part 3 and How to add Comments: welcome to lesson number nine. In this lesson, I will show you how to use an ex statement within another. If statement and I will also show you how to add comments to your program. No, at the moment if I run this program on, if I choose one python will display what is the capital city of France. If I type in Paris, if my answer is Paris at the moment, Python will not tell May if my answer is the correct answer or not. To do this, I need to add another if statement within the first if statement something along the lines off. If answer is equal to Paris print, this is the correct answer else. Print. This is not the correct answer. Let's see how it works. First, I need to create a variable. I need to I want to save. I want to store my answer to the question What is the capital city of France? So I'm going to call this variable. And so question one. Please do not leave a gap between answer question and one so answer Question one. Space equals input. We used the input function in previous lessons. This is to tell Python that I will typing an answer and I want my answer to be saved in the variable. And so question one and press return. Then we can start adding our second its statement. If and so question one space equals equals space. Paris Question lost. Don't forget the Colin at the end. If the answer to question one is Paris, I want to print. Well done. This is the correct answer. Press enter again. We have to make sure that the else is underneath it. If else Colin, if it's not Paris, I want to print. Sorry, this is not the correct answer. Let's run this script to see what happens. Right? The major scoring this typing error for us. The right run or Joe. Okay, I'm going to choose one. I'm green chant of Paris. And as you can say, Well done. This is the correct answer. No, What I would like you to do next is practice using on if within another f So I would like you to stop this video and then try adding the second if within the first LF on then so somewhere here and then do the same thing here in the second. LF I'm ready to start that first line to help you, I need to first create a variable. I'm going to call that and so question to equals input, often close brackets, and then you're gonna have to add couple or few more lines after this and the same thing here. Let's create a Rabel called and so question three equals inputs open, close bracket and then please practice using if and else within an F or on. LF by answering question to push in three. Please stop the video now and try completing your program and try running it and try entering one that as choose the right answer and hopefully the sentence well done. That's the correct answer. Should come up. Try question to and try questions. Three. No, I'm going to show you what your script should look like. This is the finished Russian off Chris. Let's have a look at it as you can see what I did at the beginning of the quiz. Like Ask Migrated, You and I asked, How are you? What's your name? I usedto variable with the input function. I use a string with a variable to say Hello. How are you? What's your name? Nice to meet you, Fabrice. Then the Chris itself. Now, this is the first if statement with the first if else within that first statement. Now, this is the answer you should have for your second question. If answer question two equals equals wrong print, this is the correct answer. Well done else, print. Sorry, this is not the correct answer. And this is that lines of courage you should have for question number three if answer question three equals equals Berlin print, this is the correct answer. Well done else. Print. Sorry, this is not the correct answer. Please take some time to check your program against my answer. No, it is good practice to add some comments to your program. This something programmers do a lot to do that you have to use the hashtag key and then you can write. This is a program the bass capital cities. Oh, the world. Or you can place this here. This is if statement now because you used the hashtag key before the text, it will turn the text read when you run your script when you run your program, Python will not run the text that is red will not run your comments. Let's have a look. Right. Run module if I choose one. So sorry about grace first. Nice to meet you, Fabrice. Like choose one. Paris. This is the correct answer welder. So as you can see, the text in red does not appear when you run your program. This is the end off Lesson nine. In the next lesson, I will talk to you about the class project. See, in the next lesson. Thank you.
11. Class Project: Welcome to lesson number 10. This is the last lesson of the course in this lesson. I will tell you about the class project for the class project. I would like you to make another quiz. A new Chris based on the topic of your choice. If you want to create a queer similar to the one we created together, you can simply change the different capital cities of the world. You could ask what is the capital city off Spain, for instance. And other countries? It is entirely up to you. Choose the topic that you want for your Chris. If you have any problem, please do. Let me know. And I would be more than happy to help you with your Chris at the end off your Chris. I would like you to upload your craze if possible. Thank you very much for following my course. And I hope you enjoyed it. Thank you again