Python 3 Programming: Your Beginner Guide to Basic Python Code | Matthew Dewey | Skillshare

Python 3 Programming: Your Beginner Guide to Basic Python Code

Matthew Dewey, Writer, Writing Tutor

Python 3 Programming: Your Beginner Guide to Basic Python Code

Matthew Dewey, Writer, Writing Tutor

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
14 Lessons (1h 54m)
    • 1. Introduction to Beginner Python 3

    • 2. PyCharm Download and Installation

    • 3. First Line Of Code

    • 4. Data Types and Variables

    • 5. Working With Data

    • 6. Retrieving User Input

    • 7. Converting Data

    • 8. If Statements

    • 9. Nested If Statements and Additional Operators

    • 10. Math Methods

    • 11. Text Methods

    • 12. While and For Loop

    • 13. Final Project

    • 14. Conclusion to Beginner Python 3

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

Welcome to Your Beginner Python Course!

Python, one of the most popular programming languages in the world and for good reason. It is one of the general-use programming languages that can be used to create applications and websites. However, like with learning any language, studying Python can be a difficult process, but it doesn’t have to be.


My name is Matthew Dewey. I have been teaching programming for over 4 years and have written books on the subject of programming, from learning the languages themselves to how to make a career from programming.

My approach to teaching is purely practical. The best way to teach programming is not through the memorising of code, but the application of that code. I will show you the code you can write out and test for yourself.

You will learn how to:

  • Install your software, PyCharm

  • Establish fundamental code

  • Create and use variables

  • Retrieve user input

  • Process simple data

  • Create simple programs
  • as well as BONUS tips and code!

Go no further if you're looking for the course that will guide you into the world of programming! With my course, I can guarantee that the knowledge you learn will help you get a head-start in Python programming.

I hope you enjoy the course and it helps you on your way into the world of programming!

Meet Your Teacher

Teacher Profile Image

Matthew Dewey

Writer, Writing Tutor


I have been writing and teaching for years, helping tens-of-thousands of students achieve their goals, be it completing their novel or publishing their work. Having written several novels, non-fiction books, hundreds of short stories and articles, I have studied and put into practice the best methods for writing effectively and efficiently.

In addition to writing, I am also a programmer and artist, teaching what I know on the subject and helping those interested get a headstart.

If you want to write a novel, a story that has been on your mind and not on paper for too long, my courses will not only help you start, but I will be there as well. Any work you submit, I will happily read, review. If you need professional advice or a friendly opinion, I will be there for both.See full profile

Class Ratings

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

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

Your creative journey starts here.

  • Unlimited access to every class
  • Supportive online creative community
  • Learn offline with Skillshare’s app

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 Beginner Python 3: path on one of the most popular programming languages in the world. And for good reason. It is one of the general use programming languages that could be used to create applications and websites, however black with learning any language. Studying path on can be a difficult process, but it doesn't have to be. My name is Matthew doing. I have been teaching programming for four years and Everton books on the subject of programming, from learning the languages themselves so hard to make a career from programming. My approach to teaching is purely practical. The best way to teach programming. It's not through the memorizing of code, but the application of that code. I will show you code. You can rot it out and test it for yourself. I'll give you examples. Homework and a handy digital workbook was Always need to know. Join me in this hands on beginner course. When I introduce you to the world of pass on programming and without delay help you build the foundation off Pathan, I'll show you how to install. The software will be using throughout the course how to write and test code. Then step are step. Listen by Listen teachers. Simple code. Until you have all the building blocks, you need to build fundamental but important programs that are used today. If you're looking for a beginner path on course, that will ensure you gain the necessary knowledge to begin your studies. Then look no further than this one. I look forward to seeing you in the first. Listen bye for now. 2. PyCharm Download and Installation: Hello and welcome to your path on programming course in this video will be downloading and installing RD. Patron Patron is one of the most popular ideas for Pathan programming, and it is also free with its community edition. So let's start with first opening up our browser. I'm gonna be using Google crumb and simply search party on. Once searched, you should see the jetbrains dot com link at the very top. He was simply click on download here or click on the link here and go to the download section so I'll just go to the download section. Now, once the pages open, you should see the splash screen over here or to take you directly to the download page for part from upon clicking the download button, the download page should look as follows. Yeah, you can select which ISS you're using, Be it Windows. Michael Lennox. I'm using Windows here. You can been download also professional or community addition. Now, all that I'm gonna be teaching you in this course is beginner path on. So all the features that we need are in the community addition, so we can don a debt, and that's what I'll be using throughout the schools. I should take you to thank you page such as this, and you should see in the bottom left corner part from downloading in your browser. I will now skip ahead to in the dollar is complete, and we can start of the installation by running this file. Once part from is downloaded, you should find program within your dollars folder. I have placed the executable here on my desktop, and this is where we'll be running it. You'll be asked for administrative privileges by the computer. Simply click yes to begin the installation, but a welcome you into the sit up wizard Click. Next to continue, you can decide where you want the program to be installed. Our preferred to leave it at the depot location just to avoid any unnecessary complications . Once that is done, you presented of many options to choose from. I prefer to select 64 bit launcher, as I do have a 64 bit PC. Most computers today will be 64 bit, so you can click us of confidence us. But for the dot p wa create associations, and once that is all selected, you can spit pick next and then in store. The installation person should look as follows and should be done fairly quickly. Once that is, complete their installation. Or ask if you want to run it directly are simply click Finish for now, and I'll be running it from the icon, which should be placed in a day. Stop and look as follows. Afterwards, you should be presented of the following. This is the you are theme selection you controls between a dark theme and a lot. Preferably, I'll prefer the dark theme as it is easy on the hours. And as a programmer you'll spend a lot of time in front of the computer, so it's based to take care of your house while you can. So I said EQT, the docks in here and our click next to go to featured plug ins. Now, nothing here is necessary, so won't be installing anything. But if you are more experienced of pass on and you're taking the schools as a refresher, feel free to select any of these plug ins that will be a suit your interests. Once that is done, you can click start using parts from and from now on whenever you start apart from and will start it from here. And just like that, we already to create a project and start coming. I'll see you in the next video. We will do just that. I'll give you a tour of patron and guide you through your first line of code. See you then Buffalo. 3. First Line Of Code: hello and welcome back to a beginner Pathan program. Ankles in this lesson will be creating our first project in Patron. I'll be giving you a short but basic tour, and I'll show you your first line of code not to begin when you open top. From now, after you've selected your theme and plug ins, you should see this launcher at the very beginning. Yeah, you can create an open project with ease on. We'll be great in a project. Here you'll be presented with a variety of options for creating a project. It's better to leave most of these options at their default, but here you can name your Project folder are simply call this Project First Project and I leave everything else at its default and click create. Now. When you first open part charm with your first project, it'll start loading some features and also presented with little of the day. Bottom has its own built in tip system, so if you don't want to see any tips, you can click done, show tips and close, but otherwise leave it unchecked or click next tip of one or browse through a selection. But now I don't need any tips. I say don't show and I could close. Was that done? Our part from is now sitting up. As you can see at the bottom of the screen is this is index seem as a load going. Now that that's complete, we can now create our first official project to begin. Let me explain what you're seeing here. The large area over here will be way. Our code blocks will be shown. This is where we will see our code and its results where we can edit them. And so long on the left. Here we are presented a bar which lists all our projects. And it is here that will great our separate projects, project folders and files that will be putting occurred in Patra. Um is an ass basic idea e And these are the two futures that we really need to take note off. In addition to that, we have all the normal features that software comes with. We are allowed to save our program. We can export. But as for now, I'm going through each feature as we need to. First of all, we need to create a project and a pass on file to begin our cutting. Now, our first project is yet very top of our projects. Tamp likely to Donora. Yeah, And as you notice that there's only the root folder, but not our pass on Project folder, which will contain our path on fans. It is based to leave the root folder as is, but we're gonna create another folder here, which would contain our path on farm. This is good practice for creating projects as you can have several files and they can interact with each other. So first I'm gonna create the folder by right clicking on first part of Project New and Directory. Our name, this directory for his project for now and I'll right click on the first Project folder and a click New pass on file, and I'll be naming the path and file the same as the folder project and click on part on file here. Was that done? You'll notice now that a code Brock has been opened. This is we will be tapping all our Pathan code, and once it's done, it is also the code that will be executing to run a program. Now there's a tradition in programming where The first line of code any programmer learns is the land of curd, which puts a line of text. And this line of text is always hello world. It is one of the most basic lines occurred to learn, so it is perfect to us the first line of curd that any prevent violence. The code is as follows. Print a set of parentheses or brackets, a set of double quotation marks and let's say the phrase hello world. And then you have the first line of code with our first line of code written, All there's left to do is run the program now on Adi usually has a built in output box, which will show you the output of your program. Surgeon Ardis were only up put certain results as they have their own sort of capabilities . But a simple output landfall around of text isn't complicated at all, Sir. Most will Prentice to run your code. One can right click on the path on file and click the run button with a green arrow. Here, you can also click the green button, appear in the top right corner. All if you are familiar with some shortcuts and like to use them in your pass on programming control shift. If Tim, we'll open up the output box as follows. Now, what you see here is three lands text. The first line is telling you which project is being run. This is useful if you have several paths on files. Next we have the airport which, as you can see, has printed Hello world. Now with that explained, allow me to explain the code Print is a lot of Kurt which outputs what is contained within its parentheses. So in this case, what we did was place a line of text within the parentheses and the way that we let our software No, that we are are putting a lot of text is with a double quotation marks Now it is also important to note before in the listen here that a lot of text is a top off Datta. Specifically the starter is known as a string. Any daughter encapsulated in double quotation marks, be it an arrangement off numbers or letters or any other characters is a strength. So what we have apogee here is a simple string. Now, before I in this listen, I'd like to give you some homework with this course is a God I've written on pass on programming for beginners, and within it there are some exercises that I recommend that you do as practice. So that were You better understand what you learn. Each listen in this exercise for module one, Section one on the first line of curd, I go through some shortcut characters that one can use in one's programming. Specifically, with this line of code, there's more that you can do with just one line of code and specifically this one. You can alter the text with special characters. Once you have completed the Sixth Sense, be sure to join me in the next listen. We will be going over variables and daughter tops. Bye for now. 4. Data Types and Variables: hello and welcome back to apostle programming course in this. Listen, we'll be discussing variables and daughter tops before we can go over variables and daughter tops. We need to discuss the daughter and information. Most programs today have a shared purpose of converting data into information. DOT is, after all, raw and structured information. It is that daughter that we collect and programs that we create turn into information that we can then use to perform tasks. I could make an example of this in our daily laps. Let's say, for example, we are thirsty. The fact that we are thirsty is Datta. That daughter registers in our brain, our brain and runs code that recognizes that daughter and that then processes it into information, saying, Hey, this body is thirsty, then it runs the program. What that information, What will tell us to go get a glass of water to solve that problem? Small pieces of daughter that start a program That's a really world example. Now let's take an example we can actually work with. Now let's say we have a team off four programmers, each with their own unique first name and last name a list of all these names is daughter. So let's just say as I'll show on the screen that these four names analyst Marko Oswald, John Holland, Harry Smith, Tim Roberts. Now we can create a program that takes this list of names and organizes it alphabetically by last names and or converts the first name into a single uppercase initial. This is a program that converts that daughter into information, and it would look as follows Jadot Holland AM but Oswald t dot roberts and h dot smith. With that understanding of dotting information, let's discuss variables and daughter tops. Variables are containers for daughter, a specific value off doctor. You give you a variable and name and then you assign it value. Variables are incredibly useful and saving daughter as well as Tom for the programmer, as you can call upon that value again and again without having to top out code as the value is the installed in that namesake, every people can contain a lot of daughter, which could be called upon bods name at any time. Daughter tops are self explanatory. We will be working with many different types of data. You have encountered one daughter, top already in the previous listen, the string dot it up. I will display a handy table on the screen now, and you can pause and study. So if you haven't really please find attached the path on beginners book. That's a guard that contains all the information on these lessons. And I do recommend you go through it as you go through these videos as well. So let's discuss these full basic daughter tops. We have the indigent daughter Top, which is a don atop that list values from negative infinity to positive and affinity. And these are whole numbers where the string daughter top, which I just mentioned, which is a daughter top, which contains text of any character encapsulated in double quotation locks. You'll see the examples on the screen now as well. Then we have floats. Floats are like integers, but they are decimal numbers instead of whole numbers, ranging from negative infinity to positive infinity as well. And finally, we have one of the simplest and most the most important daughter tops. That will be working brilliance, a daughter top that can contain only two values. True or false and machine code. This is one or zero yes or no. It decides when a program runs and when it shouldn't run. Now that we know what variables and daughter tops are, let's experiment with them in code. To create a variable, you need to decide a name and make it a suitable one for the daughter it is going to contain. You need to adhere to certain naming conventions, which are rules that help you create descriptive, easy to read names. In addition, at ESA helps you avoid errors, which you can encounter if you use a name that's already a piece of code. So you have three basic rules to remember when naming a variable. With those naming conventions out of the way, let's work with an example. Let's say that we have a list of information about a kind we know they first name, last name and your age. What we need to do then is that create variable names that will tell us what that value is . So, for example, if we want to store the first name into a variable, we can call the variable name it under school name and a school. Str this way. We know it's the first name and we want to know the top. It's a string and for last name with a B l under school name underscore str and for the age we'd put age under school. I n t Well, if we wanted to be more specific client on a school age on a school, I in t now that we have the names far variables, we need to assign values to them because right now they're containers that don't contain anything. And as you can see, that's gonna give us an era. At the moment, the way we assign a value to a variable is by simply topping and equal son afterwards and then topping in the value. So let's say the client's age is 25 and then we have a lot of code we can call upon this age at any time. For example, print and I put in Client changed into, and I run the code at Prince 25. So the code works. Now. Let's great some variables that contained the risk to the information. So if on a school name on the school S t r equals and since it's the first name, I'll give the value of John and do a last name is, well, Smith. Naming and assigning values to variables is a simple as that now. This is a quick and simple lesson, but a very important one, as the naming conventions will help you avoid any confusion during your programming. If you are going to have a lot of code on screen, it always helps to have descriptive but summarized names at the same time, and you'll find that this technique is very much easy to get used to ask to you. In the next video, we'll we'll start working with the daughter and variables bye for now. 5. Working With Data: Hello and welcome back to your path on programming course in this. Listen, we'll start working with data and variables. There'll be more practical work for this video as well be going over various functions we have at our disposal In Pass On, I'll be going over basic functions that help us construct basic information and also some mathematical functions we can use to work with integer and float variables. Now, this is a step up from the previous Listen, as we're going to start working with the values with new lands code, I'm gonna first start with a daughter top. We are familiar with the stream as it is the 1st 1 and go through the functions now. I did give you some code to test out with your first exercise, but we'll be going through them now as well. So we have print hello world like so and as we know, this was simply output Hello world and then I put box below. However, we can also include our double quotation marks if we so wish by adding a backslash with before, like so backslash quotation marks. This way we can include the quotation marks and have them printed out as well. So on the program now you see at a world is encapsulated in quotation marks. What this backslash does is let us know that the quotation marks should be represented as text not as covered. This could be handy when working with dialogue. Next, we have the tab short cut, which is simply pain. Back slash t. Instead of topping up a tab in string itself on the program, you'll see that it is not tapped properly indented from hello to world. And if we wanted something after a certain point to be printed on a new line, what we do is use a backslash in, but this will do is start a new land a moment. The text before the bag slash in ends so it'll print hello world once more was world below . Hannah. There are more complex lands occurred will be using in another module. Thes lines occurred. However, our court methods, which are smaller, built in programs what few will be making use off. I recommend you experiment of thes functions at the moment before moving on to the mathematical functions which will be starting right now. Now there are some obvious functions that we're gonna be working with when it comes to mathematics. So I'm going to erase the story here and in these brackets I'm simply gonna put out plus five. As you'd expect, this will print out 10. The addition Operator over here simply adds the two inches together at same time. We can have subtraction, which is you. See, it prints out zero. You have multiplication, which is the Asterix Shift eight on your keyboard, which prints at 25 and we have the Ford Slash, which is divided. As you can see, it prints up one. I want to you to us to take note that it prints at 1.0 as division often leads to decimal numbers to avoid any errors passed on automatically converts the result into a float. So if I divide five by two despite these being whole numbers at Prince 2.5 now we have some more complex functions to work with you. We have module ists, which is the percentage son 17 modules. Five. What this does is divide 17 by five and prince the remainder. So this would print out too, As you can see here next, we have what is known as fraud division, which is double forward slash What this will do is print out a into GIA if we so need it and tells us how many times a number will divide into another. So 17 and five again, it'll print three. If I divide five by two a. To And if I divide five, uh five. Oh, print one. As you can see, it returns an integer value only. And finally, for the mathematical functions we have exponents so we can make a number to the power of something so far. Trouble ass tricks too, which is five to the power to five times far which equals 25. As you can see here to take these functions further, you can replace any of these values with variables as well. Any of the jama'at have already created and a sound values of course, and workers of the exact same way. So if I was to create to non variables, one equals ah numb to and equals two. I get it. Replace thes values of those numbers like so and it will be treated the same way. Now all these functions in mind it is also important to understand that pass on is a way off basic mathematical order of functions. So if we were to take a math medical on such a Z briquettes plus a set of breakfast, 20 minus, uh, comes to it'll take note. All these brackets perform those values in this brackets form. It will perform the multiplication before the subtraction and so on, giving us the value off 35 which is correct. So you don't have to worry about parts on performing each math function from left to right . And finally, to conclude this listen with working with variables I'm gonna tell you about a variety over 18 is when you replace the value of one variable with another value. Unlike other programming languages, pattern allows you to override variables containing any daughter top with an entirely different auditor. In other programming languages, you have to specify which variable has a certain daughter top, and it'll be fixed to that dollar top on. Otherwise, you would have to give a new name if you want to create another variable. Little contain a different top daughter. So, for example, I can create number of yeah, give it the value of far and at the same time, I can give it the value in the next line of code. Hello. Have hours to print out this variables. Very laxer that would protect hello because five has bean over written Hello Num equals Hello is the next lan and as such as executed straight after five. Good to put this beneath. Hello. Interview of original hello than of ricin with five again and print out the value of five over. Writing is easy, especially if you don't remember which variable names you have used, which can happen if you're working with large programs. In addition to this point, if you are going to change daughter tops, don't tag your variable with the name with the daughter top in it. For example, if we have your number underscore in and replace its value with string that the name indicates that the doctor contains an integer when it really doesn't so be sure if you're gonna be using these tags that you do replace it of the same top off Datta so you can avoid additional confusion. And with that, you know some basic text and math functions, as well as some additional knowledge on how to use these variables. Now it's time to put your knowledge to the test. Once you're ready to move on, I'll see you in the next. Listen, we will be talking about how you can retrieve user input. I'll see you then and before now. 6. Retrieving User Input: hello and welcome back to your path on programming course in this. Listen, we'll be learning how to retrieve user input. Now we as programmers, great software and applications. These are products and tools to be sold to the user. As such, the user's input is incredibly important. The very keyboard I am typing on is sending messages to the computer small signals, which let the always and writing soft. We know I want a specific character to be tapped out. Now we are learning the basics. So before we can learn how to quit programs that use user input, we need to first retrieve it. Luckily, retrieving user input in part on is a simple process. Let's say we want to user to input their name for later use. We created variable to contain their name, such as air funded school name under school. And it's this dream, so str top equals and occur to get that information is input and we open up a recurrent disease, double quotations and a message. Same into your name for lawn in a space. It's a simple is that what this will do is put a line of text and Apple panel in addition to that, allow the user to write their name after that text. So let's do that as you could see at the bottom into your name colon space. And now you see a blinking long I can talk name Empress Enter now. That doesn't do much right now, but I can print out a greeting such as Print Hello Space Plus and My Variable, like so on the code, top the money again and says Hello. Now let's discuss this line of code a bit further. What we're doing here is making use of emitted a small program that allows us to complete a task such as this were making use off the input method, which allows the user to enter any daughter they wish. So now we have the ability to collect Kickstarter and process it into basic information, just like I've done so with his output line. Yeah, you can create an entire sequence of events using this method, taking input from the user and creating a powerful result. Now, before this loose innings, I want to show you a basic error that you're gonna counter when your practice. Let's say we want to collect the age off a user. So I want to collect age and and say into your age, and I'll create a output line saying something like, I am Space plus age on a school in Plus space is old Run this code I interned at age 25. Click, Enter and Princess. I am 25 years old. However, you'll find this code is not as it seems. Here is another sequence of curd, which make use of our age. That's also the output here. Just to show you wide won't work age on a school int, that's I run the program and an age it should print 30 but instead it gives us an era. As you can see from this top of error, it can only can captain eight string not into to strength. So what that is saying is that the daughter contained within age under school into is a string, not an integer, so it cannot treat it as an inter joe with the plus five. It's a very basic and common error that you receive often enough such bring that point, Tom. The input method that we used to collect daughter from the user is only collecting that daughter and converting it into a string. This way, the user can maintain and interject Can they can empty and text any characters they wanted always be converted into a string with some double quotations encapsulating Now that doesn't really help us much as programmers, especially if we need that daughter to be of a specific top. So that way we can work with it. So what we need to do then, is learn how to convert this daughter top into another, which is exactly what will be going over in the next video. For now, however, I have some exercises for you to do. You can find them and module to section one of your past on. Begin a guard for this course. So I see in the next video bar for now. 7. Converting Data: Hello and welcome back to your path on programming course in this listen will be going through how to convert one daughter top to another. Now, I've already shown you four daughter tops in a previous listen that we're gonna be working with throughout this course, I'll be showing you how to convert one daughter top to another. Have you learned how to achieve years input? We now need to take full advantage of the daughter that the user can provide. As it stands, many programs will need number daughter imported from the user or, in some cases, to rob their own number. Doctor. Of course, with some cases, you cannot convert a certain dollar top to another. We cannot convert a line of text artur into an integer or float that we can use when a user enters doctor, which does not match the required daughter top, it is known as giggle G R G O, which stands for garbage in garbage out. When bad daughter is entered, the result will be bad as well. There are ways of working around the get go, and one of them is Dr Converting. So let's go over some basic conversions. If you have done loaded your path and beginners God. You'll come to the section here where it will display all the conversions and examples. So I was to be showing them to you in this video as well. The first thing will be converting is a string to an indigent. So let's say we have a string quit word equals 50. Notice that you can only convert this into an interject if the takes contained is a number . If I added the letter T afterwards, then it could not be converted into an integer without in country in an era. So let's for the sake of argument. Assume that the value off word right now is simply a number such as 50. I think greater variable on our cool it numb and to convert that string in Tunisia, topping int, open up parentheses and top of the name of the variable, which is what, and I can use this, of course, as it could were regular interject. So it's run this coat and it prints 55 a very simple conversion that really helps us of the first problem we discovered in the previous listen. However, we're not done yet, we're gonna convert a string into a float, so let's make this 50.5. And as you may have already guessed to convert it into a float, we simply have float parentheses with the variable contained instead of inter parentheses or in the program, and it works the same way. They also find that this works. It's a very contained within the double quotations is an interject such as 50. We converted to a float over yet, and it is still treated as afloat when we are put it as you see yeah, so that's how we convert simple string daughter into number and flow tartare. But now let's convert afloat in India into a string to do so. I am going to use numb first, and I'm gonna give it the value of, let's say, 30 and then create a variable. Give it value on this time I topping str but mum and the parentheses like so, place your word. As you can see, it outputs 30 but do we know if it's number string at five to it and you see it gives us an era? That's because word is, in fact, a string. Everyone just simply had not a text after it, such as a text version of five. It would add five next to it, like so in a prince. 305. So we have converted a interject, do a string, and this will work if it's afloat as well. So let's put 30.5. Run the code. As you could see, it puts 30.55 adding the five to the end of that string, so converting an indigenous to a string is no different as well. That's fairly easy. Yet we've only addressed $3 top so far. We need to now include brewing now. 1,000,000,000 is a daughter top that will be using a lot and then following lessons. So we need to know it's conversions as well. So let's say we want to convert an Inter J into a building. Now there's only two interview values that we can convert into a building, and that is zero and one. Any other value just won't work. As I mentioned before, that Julian Canary contain true and false one or zero, the number because one for example, one is fun. Zero is fun. Any other number will encounter an unusual era in a code. But for now, let's say we want to convert one as an interject into billing. So I create a green variable, simply tough Red Bull French disease look like? So if I print out this terrible, it prints out truth. If we change the value from one to Syria, it prints out false. Now watch as I change the value, too. Let's say 578 run the code. It prints truth. If I make it negative 300 it's still prints. True, this is because any value of any interject that isn't zero when converted into a bowling all return. True. In addition, let's say that we want to convert a building into an integer so we do it the same way I make really true. Like numb equal. I feel like so, and I print no next at prints. One. Ever change the valley to pulse imprints zero so we can convert a building into an injured as well. But once more, we're using true or false and are only ever give us two values. Zero and one. Now let's talk about floats and booing. Let's say the first value is 1.0. We want to convert that 1.0 into a building. So I went out. Yeah. Bulls that you hear on the code, it prints out True if I haven't at 0.0 prince out False but zero plink one the prince that true? Because just like in Tages, if we have any other value Passat zero, it's gonna print out. True. And if we were to convert a building back into a foot, it would work the same way. Is the indigent if we have True, it would be 1.0. If we have false, it'll be 00 And now time for the final conversion, which is a string into a building. So let's create a variable. Give it a proper names that would. And I'm just gonna put double quotations, Nothing inside them. Just the double quotations like so would you and I put the result It prints false. If I put in any text in these double quotations such as false and run the program it prints True. If there's any text in a string, it will be converted to true, just like with indigenous. If there's any value that is it, Cyril. It'll be also converted to truth, even if I want to use one at a print. True, if I have to use zero, it would still be true. He needs to be no text contained within these practice and a friend's false like So now you see, with these conversions, we cannot complete the example. In the last video, let's say we have an age that the user enters and we want to print that value. But I don't another five years, so it will print something like this. I will be you plus. And then I would put str int age and his Calkin after the brackets, plus five plus ever quotations in. Yes, so let's just analyzes quickly before we run the code. But this will do is take our age, which at this moment is imported as a stream. I don't use this into conversion to convert it into an interview. Now contained within these brackets is the interview that I'll be in training plus five that I had far to the value and then convert that barely into a string so that it could be added to the string here because if we were to simply added integer, It would create an era. So it's just this out to make sure that we have it correct from the program out into an age of 25. And, as you can see it is obesity in five years, properly calculated and converted, running without fault. Converting from one daughter top to another isn't too difficult. If you keep these methods in mind, be sure to keep a cheat sheet handy as a beginner or this guy that I have told you about and use it as a reference if you need to. In the next video, we'll be working with if statements which will allow us to create conditional code and you'll be learning more about that as well. So I see you then bye for now. 8. If Statements: Hello and welcome back to your pass on programming course, unless listen will be going over. If statements if statements are incredibly useful pieces off code with them, you can create Kurd that will only run if a certain requirement is met. As off now, all our code will run any sequence from top to bottom, but with if statements, we have more control over which could runs and which doesn't. For example, I brought up my keyboard in a previous chapter with each struck of the key and assigned letter for that key is topped out. These are simply if statements running in the background with a writing programs such as a word document but processing the space ball. The blank character is printed. However, if a prison space ball with a video programme open the video will pulls. Both cases have the same condition, just different code that runs when the key is struck. As programas, we could decide both the condition and the code now, before we can start creating. If statements we need to understand what conditions are, many of which you should already be familiar with, conditions can only have two results, true or false, That's right. The result of a condition is a 1,000,000,000 value. If the condition proves true in an if statement, the code that follows will be run. But if it proves false, the code will not. So let's to start a basic if statement created, if statement you talking. If open up parent disease and we'll write our condition between these brackets, I'm just gonna put value of True. For now, at the end of this burnt disease, we have a column repressed. Enter, as you can see, has already indented the code because the curd that is indented and following this if statement, will be the code that runs if they if statements condition proves true. So let's just put in a basic curd such a Z, a print line saying it works. If I run this coat, as you could see, it prints. It works a very basic if statement and he contested out false as well, and you'll notice it doesn't print anything. Now let me explain how this good works when we create our first if statement lamb, we're simply topping if a set of brackets, which would contain the condition and if it proves true the code that follows the colon and below will run. The way we could tell which code will be run is by the ending. So if I put another line of code here just below the first print and offered another one below this. But it is not indented like so and change the condition to truth so we can see. But drugs as you can see it prints or three lines of text. But if I make it false, it prints only the last line of text as it is not part of the if statement, and as such, it will run irrespective off any condition. Neatness and code is absolutely important, especially when it comes to if statement as if you don't have your Kurt properly indented below the if statement when it should be, it can lead to errors in your program. Now that you have seen some basic if statements, let's not start building a collection of different conditions as there are many examples. Generally, a condition is comparing two or more pieces of data with each other, depending on the function use, it could be asking how different the daughter is or how similar so Let's break down some basic conditions, and let's start with the mathematical ones as thes are no doubt the ones young more familiar with. So let me take out all occurred here and simply top up. Front five is less than six. When I run this line of courtesy, it prints true, because this condition within the print has been run and and has given us the results of truth. But in addition to list, then we'll have great to them. As you can see, it prints false with greater than and less than one has greater than in equal to and less than an equal to. Now what happens if we want to compare two valleys? Teachers? We don't simply top five equal six. We must put in the double equals symbol here, and what this will do is compared to values to see if they are the same. And as you could see, it's false. But if I changed 56 a prince, true, so that is the equals to function and they're not eagles. To function is an exclamation point, followed by the equal son sighs. You could see this will print false because six is equal to six. Better change one of the values to another number it prints. True. These are standard basic mathematical operators, which you often use in your programming before moving on. I recommend that you test the code that I've just shown you and see if you can create some . If statements with the mathematical operators Now, those basic conditions you can create many useful if statements comparing doctors exactly what you need to do to ensure you manage and process it correctly. Who example? Let's say the user inputs the age, and you need to check if there's that he is old or older. So it's great that code now equals, said brackets, because we needed converted from a string into an integer said print disease in tow. Bill age. Now we create an if statement age under school, and you notice that I'm not using parentheses. That is just fun, as we're not going to be using many conditions. So agent is greater than or equal to 30 after an it turn on in tow, and the code that runs will be you are 30 or older, so let's taste start this line of code in tow and 29. Nothing is printed entering 13. It prints the text and, of course, anything more than that. 560 and still Prince Alana text. Now this is a simple but important program that is used to check the age of clients and many services. To take this further, you can even compare strings. Using these functions, of course, has to be case sensitive as well as if a letter is in a different case, although it being the same letter, it'll be read as different. So let's test out. There's code here. Name on a school string equals, and I'll give it the value of John Capital J create. If statement name on the school string equals equals young Sprint and simply put a lot of fixing, it works. When I run this curd, you see it prints, it works. But if I change the value of John to a lower case and James to have Anapa Case J, it doesn't print anything. Now there's one crucial part about if statements that we need to go over before we can start practicing. What happens now if we want to have another condition that runs when a value proves false aren't only the proves true, so we can actually create, too, if statements to do the job. So let's create a new piece of Goodyear. Let's call it a J again equals and I'll give it the belly of 14 are creates an if statement that asks and checks to see if they age is 40 all older, and I'll just give a basic print out. Great. Another if statement that I'll run if the opposite condition is meant like so, 40 years is your 40 and older 45 same thing. But let's say I put in 39. It prints that other line of text. However, we can save on topping. Seen as we want to print out an alternative land with this one proves of false. Instead, we congee just take this part out here and put in else instead. What this will do is take the above if statement, and if the value of the above if statement proves false, it will print out this line of code here, as you can see when I run the program. As you can see this code of start to read more like a sentence if age is greater than or equal to 14. Front. You're 40 or older else print. You're younger than 40. This is a great way to see the logic in your if statements. But now, before we end off this, listen, I'm gonna take this even further and I'm gonna create. And if else statement that will check three conditions, let's say we're checking age. But if the age is equal to 40 at Prince, you are 40 and then we want another condition. With the ages older than 48 Prince, you're older than 40 and another condition way. If you're younger than 14 it'll print your younger than 40. So what we'll do instead of an else is put e l. If so, and yeah, I'll rot and new condition age on a school and is greater than 40. So that I put you are polled 40 and then are finally and little else. If everything in this if else statement, proves false, so I don't need to write condition, Yeah, there's only one other condition that could be admit. And that is if the client is younger and 40 like so. So let's test this out. As you can see that works for 39. Now let's make this 40 prince you are putting and any older than putting reference your older. As you can see, we have three lines of code that will run depending on certain values here, as we have an infinite selection of numbers to work with. You can continue this if statement, as long as you wish, with constant chicks with E l. If so, if other sort of numbers are met, you have a specific message. But otherwise they're else will be the defaulted results to if everything else approves faults. Now, as you could see, if statements are the most complex pieces occurred. We have learned so far, and there's even more to be taught about them beyond this. Listen, and that's exactly what we'll be doing in the next video when we go over more complex if statements nested of statements and additional operators. So I leave you with this exercise to complete for this video and I'll see you then, Bye. For now, 9. Nested If Statements and Additional Operators: hello and welcome back to your path on programming course in this listen will be going over nested if statements and additional operators in the previous listen. We worked with the more advanced but more important part of part on programming. If statements are one of the major building blocks of many programs that read daughter and perform conditional commands in that, listen, we took it further by using else and else if statements these if statements are incredibly useful. If you want one specific condition to be met, however, let's say that two conditions need to be met, in which case we need to make use of a nested if statement one additional operator. Now, if statements can be incredibly complex opinion on the doctor you're working with and in many cases nested if statements or an additional operator is essential for simple, efficient code now invested. If statement is an if statement within an if statement, you can take this further by creating an if statement within an if statement within a brief statement and so on. When working with different clients, you may need to check multiple fields of doctor to see if they meet the right requirements . A great example of this programming is filters. Filters often help us of our searchers on certain services to find a specific atom or service. As such, it does helps us get a good idea that process, quality and so on. Where they are looking for a book, a job on apartment filters help us find ideal choice. Foster was that said, Let us great and nested if statement, which allows us to check multiple fields of daughter and decide if a client is suitable for job. So what I'm gonna do is ask the user to enter in the first name, and I leave this as a string as well. I'll do the same full of last name. Next is occupation and an interview available, which contained a number of years of experience they have field. So, of course, I will be converting that from a string to an image as well. So let's start with the first condition off this invested If statement first, let us now check to see if the candidate has experience in the field, which is librarian. So our US that year next, after the six day monopoly on another one, this time checking to see how many years of experience they've had in that field, and I want five to be the limit. I'm looking for the very minimum. As you could see, it now creates a double Indian tae shin anoca put in a lot of occurred, such as printing the name of the applicant, which is qualified. But of course I do. You need to have an else statement for the second, its statement within the if statement. So I just put it else and a default lan off candidate is not qualified. I'm gonna copy this line of code here and paste it like so make sure it's properly indented , and now we have a program we contest out. So let's say the African interest in the details. John Smith. We put in librarian and we say that they've had 10 years of experience in the field. As you could see at his, John Smith is qualified. Now I'm gonna intend same daughter, but make an adjustment to the Korea that they had full. So let's say they were an accountant and they had five years of experience. T candidate. It's not qualified for the field, which is correct and it would say the same thing if we do fulfill the first field as well. Smith, one small librarian, but will unfold the first if statements condition. But they only have three years experience. Candidate is not qualified. So there we have multiple fields being asked all within a single if statement. This way we can avoid any unnecessary outputs nested if statements helped us make this program. But we can also use additional operators. In some cases, it be better to make use of them than the nested if statement as it would save us code. However, both have their uses. An additional operator is an operator that allows us to have more than one condition with an If statement the two operators will be using are the end and all operators. The way we use these operators is as follows. I'm going to take out the following if statement here, and I can add a condition onto the first condition with the if statement here I am gonna be making use of the end operator as we do want to fields to be fulfilled. So we top it and and I put in e and greater than legal to five. And just like that, we saved ourselves a few lines of code. Madison, using a additional pretends, did oven east it. If statement now the end operator, allows us to make sure that two fields in this case librarian and five or greater to be fulfilled. However, we could take this further and continuously add more conditions that need to be fulfilled, whereas the all operator makes it so that at least one of the conditions needs to admit. So if the candidate was not a librarian before, But they have experience above five years, so let's just test that out t announce. Well, then it will still run the code within the S statement. So that's a seven years of experience. John Smith is qualified, even though we were looking for a librarian. So in this case, we wouldn't use the all additional operator we would use the end program. But of course, they are gonna be programs win or can be used, and it is better to do so now. Before we move on to some more examples in exercises, I would like to bring up an important part of programming optimization. It is easy to create a useful program that is messy and often unnecessary code. As you can see, yeah, we have used a nested of statement way a additional operator would work better. Now. The difference between these two pieces of code is fairly nominal. But when it comes to large lines of code and greater programs, that helps to create more optimized code to make it run better and also make sure that his laced taxing on a computer system in addition, it makes you could easier to understand. However, there are some cases when optimizing your code can make it look, monsieur, even though it will run bitter. For example, we can take these import lands and use them to replace the values that we have here. So, for example, first name. We could take the input lines and place it yet, and we could have to take the occupation line and replace library in over a year and so on until we have no need for variables at all. But what this will do is create rather messy lands code, and that'll make it more difficult to work with. As a programmer, however, we can actually make you so this Yah by taking these inputs on replacing their variable values. The code? Yeah. So I take input, previous occupation as well. And I put it here, but I do want to ask the candidates names first, So I'm gonna leave these variables above here. We saved ourselves two lines of code or even though that we have a monsieur. If statement condition to work with, we can still understand what is going on if we read through it slower. So in essence, we have optimized this code and still maintained a cleanliness and the code to understand it, especially if we're gonna be working with more candidates. And with that, this listen has come to an end and the next listen, we'll be going over some methods when it comes to mathematics. Finally, I want you to practice in the study of statements in additional operators with this listens exercises and I see in the next video bye for now, 10. Math Methods: hello and welcome back to your path on programming course in this listen will be going over math methods. Now there are a variety of math methods at our disposal, but before we can use any of them, we need to import the math class. Now. I'm sure this creates a lot of questions on much more than how and miss it. First of all is a small program that completes a task as I've mentioned previous lessons. Now a class is a separate, larger program, which is made up of methods that we can call and use. The class we are importing into our program is called the Math Class, which is a variety of methods that help us work with numbers. Now, to import the math class, we need only around the following code at the top of our program. Import math. I just want to make note of this properly as well is that when you're importing in classes that you plan to use in your software, it always helps to organize it with all your inputs at the top of the screen. Organizing our imports at the top of our curd helps us check to see if we have properly imported or not occurred that we need. Once you've imported the math course, we're ready to learn our first mess method. So the first math method will be learning is the ceiling method. It is this method which will take a float and round the value up, returning an integer. So take this code, for example, we'll create a nonverbal and give it the value of farm going. Now what I'm gonna do is print at the result of this methods effect to make use of the mace it by simply top in math, docked seal and within parentheses, the name of the variable. Now, just let me explain this before I run the code. Worry top in mass. We are calling the class as you'll notice it is no highlighted at the top of the screen. Now, before going any further and run this land of Kurt, I'd like to explain what it does. The first part of the code is mass, which, as you noticed, has highlighted top line of code on the import. This lets us know that this class is in fact in use. We have called this class by tapping in Mass. And to make use of a message we put dot and the name of the method and to make use of the message, we put a period followed by LTD's name in this case, seal who ceiling now. Often these methods were cry us to have a parentheses at the end of them Now. Often these methods requires to have a parentheses at end, as it does sometimes required doctor from you. In this case, we're providing it of the daughter numb. So now let's run this line of code and see what the myth it does. As you can see, it runs it up to the news value of six. The only problem of this method is it doesn't round off the flood number based on the number after the decimal point. It simply takes the value of the whole number and adds one. If there's anything other than zero after the decimal. So if we had 5.1 here, it would still round it up to six. Now there is an opposite to this method, which cuts off anything after the decimal place. This is called math, not floor. As you would expect, we simply change the line of code like so and it runs it down to five, mainly just cutting off anything so we can have 5.9 and would still run down too far. Now with these methods, Amand, if we want around our number up based on the value of the first number after the decimal place, we make use off the round method. No, this is not a mass method. So we do not call the math costs like we do a floor and ceiling to simply round off a number. We take corduroy. Yeah, and we top in round And this will properly round up a number opinion on and study, So changes to three grounds it down 25 Now let's say we want around our number or to a specific decimal place to do so We use the round, but follow it with a comma after the number and a number representing the dismal place we might we want to run that u solitary around in the number 5.344 we rounded off here with the round Miss it. We put in a parentheses with put in the name of variable, calmer and to what place? So we want to round it off to the sick and dismal place. So does so. Yeah. Now an incredibly useful method for working with facades data With this daughter, we can then create a general rule when processing our daughter to round it down or up to a specific decile place, or to make use of the whole numbers only by using floor ceiling. The next mated now is fairly basic, but once more and essential method for working with number based daughter. It is a math method square root, otherwise abbreviated two sq rt, which returns the square root of any number. It will always return afloat daughter top. So if the number doesn't have a whole number as a square root, you will receive an accurate flood number, which works as well. So let's take these examples. For instance, if we put in 36 year and we make use of the mask that s Q r T mated like so parentheses, and we feel numb and run the program and I put six, which is corrected. Discredit 36. But it is also a flood. Now. If we were different, the seven and run the good, it will return a foot. But as you can see, it's a lengthy number here for us to work with and finally for the last method we have. Factorial. This method is fairly self explanatory. It will return the factorial of a number placed within the brackets. Since this is a math mated, we call upon the math cost like we do the floor, ceiling and square root. Now, as we know, factorial is a number times itself minus one minus two, minus three and so on until reaches zero. So if we had five factorial, it would be five times four times three times two times one, which would result in 120. The code full factorial is as follows math that factorial and let's just put in the value far instead of working with a variable is there's no need. We're on the code, and it outputs 120 now to in this lesson off. The math class has many more methods, but the ones I've shown you are the most useful, and you'll most likely be using more than others. You'll be using these to help process daughter and execute Sergent code, depending on the results. In the next listen, we'll go over some text methods, which will be using to search for specific words, cut text or extract search and characters. So good luck with the exercises, and I'll see in the next video bye for now. 11. Text Methods: Hello and welcome back to your personal programming course in this listen will be going over text methods now, like the previous listen, we'll be going through a selection of useful methods that will help us process and use. Darter in this video will be using eight useful methods or to help us collect data from strings. You're not need to import any special classes to use these methods, so let's just start with the first method. The first method when it comes to working with string darter Little Bellini is the length method. This method is used to get the exact value of how many characters there are in a string. The characters can be anything from laters to numbers symbols to simple what space it will return an integer value. Let's take this code. For instance, we create a name variable and give it the valley off. John. If I was to put the length this name like so admit it is a simple is that noticed? We don't have to call a specific class like math, not before using the method. We simply is the method. When we run this method of Prince full, as they are four characters within the string itself. And of course we can use sentences such as My name is John and it will include what space into the number of characters, a very simple May said. But it comes in very handy when working with DR such as this. We have now to more methods, the upper and lower case methods. These methods are used to change the case of all letters in a string two other upper or lower case, respectively, that makes it like this is important to create what is known as uniformed daughter. In the past, we used if statements which checked lines of text. However you notice that it was very case sensitive. If we had one character that wasn't the Rod case, then the if statement would not work correctly. We can easily solve this problem by converting daughter to a uniform case such as Lowell Upper case. So let's test out the lower missing, like so would take name and give it value off Brian. But I'm gonna make a character too upper case as well. Like so. And I'm gonna print the values now not, however, that to use this method, we have to have a variable, and we have to call it the same way we call a class. So we called the name variable. In particular, we put dot lower or upper. Let's use upper First and a set of parentheses, which will leave empty. And we didn't run. I'll cook notice all letters that were in the lower case we converted to uppercase surfers to make this lower instead of paper or letters will be converted to the lower case instead . Anapa Case. So let's quickly make use of this method with an if statement if we needed a name to be Brian specifically. So let's say if name underscores to our equals that I'd say Brian and the full lower case print a string. Let's just say hello, Brian, like so at an extra equals they and missed one. And now let's also make use of the May said. So let's ST dot Blower said. Prince sees take up this line of texture and to stop the code every works correctly. It should print Hello, Brian, and it doesn t it converts this Brian into a full lower case, Brian which compared to this one, is the exact same and then it prints that line of text. So that ever comes one problem that we're having and occurred before because we had to rely on the user to intend the correct Arte with uppercase letter in the beginning, at all times. This way we can make sure that number what the user enters as long as it's the name we can then use that daughter effectively. The next method we're gonna be making yourself is count Method. The count method is used to find a specific character or sets of characters and count how many times they are mentioned in the string and then finally return an integer value. For example, if I create a string now and I just call it would school str equals I am a programmer and I print the count value. So we have to use this the same way we use upper and lower as well. So we put in the variables name would voiced er don't count and I want you to count how many times that it to a was mentioned throughout a strength. So run this code and it prints three. As there are three A's throughout the string. We can also use this to scan text for specific words, not just characters. And if we wanted to make sure there were words, we'd include what cities before and after. But for now, let's just say we want to see how many terms and is mentioned, and you'll find it is twice it counts this AM as well as this M in program. So what we need to do is adjust the code if we want to do look for the word specifically instead of just any mention of the two characters, so it includes space before and after, and then it would print. Once this is very useful for censoring lands of text, you'll find that to avoid any profanity in text, programs like this will ensure that names don't include any bad words. So that way, the use of I have to keep entering in different combinations until finally, they have one that doesn't have any profanity. That is just one of the bigger uses off this top code. However, let's deal for problem that we currently count to here what this will do. They searched the text for the word AM, but we have surrounded it with two watts spaces. If we were to start this sentence with um and run the program, you notice it's still up. Puts one. That is because there is no what space in front of the first word. So how do we check the first and last word now? If we want to search for the specific? Would we then make use off two more methods to check the first and last word in a sentence ? So these next two methods are the starts with and ends with methods. These two minutes will return a 1,000,000,000 value of true or false now, in order to properly count how many times a word was mentioned, we'll need to make use of if statements, The code is more complex but accurate. So let's make use off. A large string has put in word on a score. Str equals and sentence like money is Jason. Come on. My friend's name is Amy Bean. Then create a counter variable. And what we're gonna do is make use of two methods to make sure the daughter is uniforms. The first is the lower method. Would you convert everything to the lower case so we can find even upper case of mentions off searching would and it's a the wood with a careful is my because they are three mentions of my and one of them is included in a me. So we need to make sure that is excluded from the count as well. So dot count ace it granted sees space m y like So now this would count all the mentions of my in the sentence normally, so that would include the one at the beginning, All the one he had the end because it is not surrounded by a space. But it will include this my in the middle. So count underscore int will then have one added to its value. Next will be making use of an if statement which will check the beginning and the end of the sentence. So if word on a school string and lose that lower once more to make sure the doctor is uniforms ends with and inside brackets inside double quotations were simply top in my Kerlan Count School int. It was a company on a school in plus one that adds one to if statements value, we can create a second if statement this time I'm gonna copy this letter code here, and I'm gonna put instead of ends with I'm gonna It starts with, like so if it count equals count on school into us one. It's a simple is that and outlets print the value print count on a school. And now, before we start the program, we're gonna add a space before my here and my space after here and run the program. And it counts too, Which is correct because it includes the mind of a beginning doesn't include the mind very end, and it does include the mine in the middle. So that is the starts with and ends with methods. Now we have another two find and are fined methods. The funding are fun. Method are used to find ways Certain text is in a sentence. It will return a number representing the first instance in the string where that segment begins. However, I want you to note that the first character in a sentence as the value place off zero and accounts from the so the second character will have the place value off one and so on, so it doesn't count the values from one another. but zero and up. So let's make use of the first fund method I'm going to create another would like. So I put this is a test and I am gonna print word string that lower to make it uniform. Daughter, I don't find and I want to find the word is so it doesn't include that is in this. So what it should do then, is print a value off. And now we encountered zero value for too. So it's 1234 It should be at the fourth place here, seeing as we include the white space we run the code and it prints for And if we were to take out these spaces on the card ever print too. As it is, the second place value when this word begins there are fermented now is the same as this fund method, although it works from the end of the sentence to the beginning, thus giving you the last instance of the text you're looking for. So if I was to use our fund is like so you'll find it Prince fast as the eye and is in the fifth place value guys wanting to find the last instance of d'Amboise. It'll be disliked before and show only the fourth battery because we include in the white space is before and after. With these methods, you can scan text for any values. So let's make uses incurred to extract characters the fund omitted will give us those values we need only make use of those values to extract the daughter is. I can extract certain characters from a stream simply topped print the name of variable continued text and place in the value off that character we want specifically. So let's say the fifth character, which we know is the eye and is it meant that and it prints. We are just like that. This is what is known as indexing by Internet index or the character we can extract a single character or perhaps entire segments. So how do we extract an entire world from a sentence? We're simply out of column afterwards, so if you want to, they extract the wood is then we're gonna have to top in the character that starts it, which is the fifth value Kerlon, and then a number that represents the value off the character. Once it has ended so it won't be the six character, but rather the seventh character, and it wont include the seventh character. So we want to you extract is simply put seven. We run the code and it is extracted. Would is from the sentence. So to explain that further, the first digit is where the segment begins inclusive of that character and a second digit is where you want to segment to end. But it is not inclusive off that character. With this. We can extract words and text or entirely admit, Um, so let's take I sent in such as this? No, they and this time will print everything before the sick and value. So we'll just include nothing as a first digit and discuss straight to Colon. And the second value would be l. So it's not inclusive of Ellen the second digit. So just printed He Of course, we can continue the sentence without those Els. So if we don't want to include the Els Year, we won't use the third character. So this is the second place very l. This is the third place value. Our and then we want to make use of the fourth place value So we add on word string on a school and forth, Kerlan, and leave the second agent blank. But this will do is print everything after the fourth value. When we add these things together, it prints hello there. But excluding the els. So this is a great way to process daughter to cut out anything we don't want and print out the result. But that brings us to our final text method. The replace method. This method allows you to replace a specified segment of text with another segment of text , for example, will create another variable, and I'm gonna rot. Hello. My name is John, like so, But I wonder a place John with another name. So our first printed up and then make use of the method one small. It requires you to top variable dot replace. They set off parentheses. We're text that we want to replace, which in this case, is John under school, and I want to replace it with Robert. And now let's just print out that value. And as you could see, it prints. Hello. My name is Robert, And this can also save you the trouble of during some indexing and finding a specifically where a certain would is. But of course this is character sensitive, so you will have to convert doctor. But once it's converted out, putting it will make a different result. Where characters should be up a case, they'll be lower case, for example, so you have to construct a program logically around this method. If you want to use it effectively, in which case it is better to do it as I have done here. And if that we have covered all necessary takes methods for this video in the next listen will be going through loops both while and four loops are effective ways to save us from repeating code throughout our program. Be sure to practice these text methods, using the exercises in your pass on book, and I see in the next video bye for now. 12. While and For Loop: Hello and welcome back to your path on programming course in this listen will be going over loops specifically the while and falling. If you have been experimenting of the Cody of Learned, Sir Paul, you have no doubt notice that in creating larger programs, you need to write out more lines of code a problem that is very clear if you have to enter large amounts of daughter separately. So this can lead to repetitive code throughout your programming experience once more. This is a problem that could be rectified with code similar to an if statement. These are called loops and we'll be working with two kinds of loops in this video while lips and full lips the first look will be going over is the while loop as it will help. Better explain the fundamental concept of a loop. With that said, I'd like to demonstrate some good for you Post. I'm going to create a count Variable. Next, I'm gonna make use of a loop to count upwards from 10 continuously adding to this convertible and printing the value. But this is gonna be done without writing several lines of code that are necessary to create a while if we started like an if statement. But that was started while, and we give it a condition. While count on the school end is less than 10. The column Now this condition states that as long as this condition proves true, whatever follows will be run. But when it comes to loop, it'll run the card that follows continuously until the condition proves false. So in this way we can easily create a never ending loop. For example, I print out count variables value, thanks so and run the program. You notice it continuously, Prince zero over and over and over again, and this will continue until we stop the program by clicking is little read. But in here. So what we need to do? We're working with a while. Loop is make sure that there's a condition at once. It's proved false. The Rupel stop and I'll move onto the next line of code. How we do that to simply add two counts value in this instance, so county toes count School int equals plus one. This will add two counts value, and when I run the loop, it'll run 10 times and it will print out the values continuously until the value had hit 10 . If I wanted to include 10 I could put equals two here and run the program. But this will run the loop 11 terms. So for making it even, I just exclude the equals. Have a loop that runs 10 times. But as you can already see, this has so much potential in your programming. If you're to enter in multiple pieces of daughter, you can have the loop continuously run until one doctor PC enter. Let's say the would stop has been entered Now to break this down further a while, Loop has a clause just like an If statement with the claws proves true, the code within report run. We can take it a step further and use other forms of daughter like an if statement. So I'm gonna show you another example Now, Storm, I'm going to be in Jinan names. I'll give a empty value right now to the variable and I'll create a while loop that will stop. I'm just going to converted to upper for year from daughter. Well, if that'll stop once, the would stop as being entered and I could make use of use input this way and it's to stop this cooked so it Oscar Stainton name. So we do intend John John is fun. Thanks. Very and so on until Argentine stop And this come being any case, I want to because I used the dot uppercase method CST a capital, and it has been stopped once more. This is a very useful way of entry in large amounts of daughter without having to enter large amounts of code, we could collect daughter one by one into with everything entered. Now, the while loop can be used a many number of ways comparing all sorts of data. With that amount, you can create a while loop, which is useful in almost any formal program. However, if you want to create a loop that will run a specific number of terms rather than compare different daughter, I would recommend the fall it The full loop is a loop with a comparable applause, an incremental incremento being a variable value that constantly increases by one all in one line. It can save you several lines of code, which is of course, fantastic. So I'm gonna show you an example of the flu now cool. Create the variable in saadiya, Count in range zero on a school 10 and artist print counts value here like so when I run this loop, you notice that runs stained Tom's going from 0 to 9 the full. It is a loop you'll use more often than a while loop in most programmes in some loops. It isn't so important to check daughter, but it is important to run several sets of code, a set number of Tom's and that sense practicing of both the for loop and the wild is essential. Now allow me to break down this full up a bit more, as you can tell, We started it the way we started. If statement or while, look, we simply top in the name of the movie. Next, I've created a variable, and then I topped in in range. But this does is it helps. Instead, she eight ways Lupul begin and where it will end. So in the range, off 0 to 10 it would continuously run until the value is 10 and that is not inclusive. Often as you can see a za printed out, the values here does not include 10 below if I did run to include 10. As I said before, I would make us 11. And it would look like this after that in the claws of Colon and followed to the code that I want to be repeated. Now that brings our final practical listen to an end. In the next video, I'll be giving you your final project and providing you with an answer as well. You can also find this final project in your path on workbook, which I hope you have gone through as well. It could be incredibly handy, especially if you're gonna be working off a larger programs so you can constantly use it as a reference. However, before this listening, I just want to make one family note on the subject of loops, seen as they're very similar to. If statement, you can also contain loops within loops, within loops and so on, pretty much like a nested if statement, we can create nested loops at the same time. We can also use additional operators if we feel the need. However, when it comes to most loops, you won't need more than one close, especially as a beginner in part on programming And with that, this lesson comes Journey. And and the next video, we'll begin our final project. Or as you can find it in your workbook exercise for Module three, Section three. Now, this is the largest program we have worked with so far on this course. But I feel aptly challenges you on the certain pieces of code we have learned throughout his course. I believe you have all that you need now to complete this project. But of course I will be showing you the answer and the next listen as well on that note. Thank you for watching. And I'll see you in the next video. Bye for now. 13. Final Project: Hello and welcome back to your pass on programming course. This is the final practical video where we'll be doing the final exercise in the workbook. This is the biggest program we have created so far on the course. And as you could see, I have created a new project. As is the first step in this lesson, we have to create a new project called movie Gree tha. Now I will be showing you this exercise on the screen now and then. I'll give you some time to do it yourself. And once that is done, I'll give you an answer that you can use to compare to. So I recommend pulls in the video here or looking at the exercise in your workbook. This is module three section threes. Exercise once. You already, I'll show you my answer. Okay, so now let's begin. The first thing I'm gonna be doing is creating all the variables that I'll be using throughout this project. First, our create a variable to contain all the first names. How really need to create one for the first name? No more. Despite the three values, I can use this variable again and again by simply over writing it. The same goes for age and then create some counter variables for entries and no entries now , then create a oldest string variable, which would contain string. The reason I'm giving these values to the variables now is because if there is some error in the program or something cannot properly process, it still has these defaults to fall back on, so I can avoid any of those traditional areas. And then, of course, I have a variable to contain all the stage and a funnel string. Now, some of these variables may not seem so necessary, but, as I said, this is to avoid any basic hair is later in the program. Once that's done, I can move straight on to the first loop, the fall, it great full lip for make use for the count variable range. And I want this to run five times so far, and I'll get straight into inputs inside this. Fully ask the user to intended first name and place, the value within the first bearable, and I'll be doing the same philosophy and finally the same for the age. Notice that I am leaving the indent because I want the following code to be contained within this full loop as well. So I'm gonna create a if statement now that checks the age shape is greater or equal to 16 . Next, I'm gonna be adjusting the final string Aziz Inter and the values. So if this girl's name is God's strength zero dot upper. What this will do is get the first letter from the first name and converted to the upper case, after which I'm going to add a period space and then the last name that line of could out of the way. I'm not going to add to the entries value as there is a person with the right age. So I'd want to its value like sir, Now I create an else for if it proves that the age is less than 16 and I've just copy some of the code Yeah, and adjusted accordingly to say no entry. With that done, we have created an if statement that will count to the injuries and no entries, but we're not done yet. We're so need to now count the oldest. Now, the way I've got about this is created a separate variable that it can be compared to. So if a change is older than another age, in this case, the old int would recognize the default value of zero. So the most likely will be an applicant here that is older and then replace the old interview value with the new one that the user has entered. But of course, like I said, this is only if it is older and then create an oldest string like so equals. If his name school string but first name plus space for us, no school name, Let's go String Yes is the oldest something footing Come on. And at the age afterwards, just converting it to a string, Of course. And there we go. We don't need to creating else for this, and we're so don't need to include it within the loop. We're not simply print out a funnel up puts. So that's final string. Once that final string is out, we need to give summaries. So we're gonna print out how Maney Allah entry next. So that's a plus. Str numbers of entry. That's but no entry. First times it by 20 to get the percentage plus and then it percent son are not allowed entry. I think so. And now put a backslash in start the next limb plus str entry on a school int terms 20 plus centered son are allowed entry as simple as that. Finally, another backslash in Yes, all this string, which will print out that oldest string that we've created now that all that is left to do is test the program. So I'll success Dent in the first name. So I'm gonna go ahead and start entering in values. I'm gonna put John Smith first with an age of 25 well into another one. Let's say Nano Roberts, who is 16 then we have Kevan been Cem, who will make 15 in Tim Thompson, who will make City. He'll be the oldest and finally, Frank Stevenson, who will make five. Now let's check our final output. CIA at Prince J. Smith John Smith is a lot entry. Just correct. Flannel Roberts. Here is a lot entry, which is correct. As you could see, Lana Robertson's age is 16 so they're just old enough. But okay, Benson is not allowed entry, which is correct. They below 16 T. Thompson is the oldest. Obviously, they allowed entry and Frank Stevenson, whose father is obviously not allowed entry. So we have to know entries. So that's 40% which is correct, while 60% are on entry. And Tim Thompson is the oldest of the age of 30 as the final output. So our program is working correctly. I hope this answer has helped you in some way. If you have struggled through this final exercise, there are always ways of simplifying occurred. But I found this is an ass basic way to simplify it while also making sure it's easy enough to understand. And if that the course has come to an end in the next video are conclude to what you have learned in this course and way to go from here. Thank you for watching. And I'll see you then. 14. Conclusion to Beginner Python 3: Hello and congratulations. Having reached the end of this course and completing all your exercises, you have a beginner's understanding off path on programming with practice. The code you have learned in this course will give you fantastic a logical understanding off programming. It is this logical thinking that I'll help you solve problems when encountering errors, or better yet, avoid them altogether. It will help your creativity as well. For it, you know, ideas for programs into action with sound code. Now, way to go from here. At this point in your studies, you're ready to move on and study more difficult coat. This begin, of course, is giving you an understanding of how code puts together. But there is more to learn their loops. And if statements, however, I cannot understate your achievement, you have taken the first and hardest step. Continue your path on studies and developing ideas for programs. Test out your knowledge by trying to put these ideas into practice. Doing this will help further develop your skills with Pathan programming, and soon you could make a career from this knowledge. Thank you for joining me in this course I hope you enjoyed and happy programming