Python 3: A Beginners Guide to Python Programming | Tony Staunton | Skillshare

Python 3: A Beginners Guide to Python Programming

Tony Staunton, Reading, writing and teaching.

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
131 Lessons (7h 53m)
    • 1. Welcome to Beginners Python 3

    • 2. Skillshare 101: Getting the Most From This Course

    • 3. Topics covered in this course

    • 4. Install Anaconda, Python and VS Code on a Mac

    • 5. Install Anaconda, Python and VS Code on Windows

    • 6. [Old] How to install Python

    • 7. An introduction to Python variables

    • 8. An introduction to Python Strings

    • 9. How to concatenate strings in Python

    • 10. Using Python's string title() method

    • 11. The Python find() method

    • 12. The Python lower() method

    • 13. The Python replace method

    • 14. The Python strip() method

    • 15. How to add new lines and tabs in Python

    • 16. Working with integers in Python

    • 17. Working with floats in Python

    • 18. How to convert numbers to strings

    • 19. What are Python comments

    • 20. Introduction to Python lists

    • 21. How to edit lists in Python

    • 22. Adding comments to our lists

    • 23. The Python pop() method

    • 24. How to organize a list in Python

    • 25. How to find the length of a list in Python

    • 26. Looping through a list in Python

    • 27. An introduction to numerical lists in Python

    • 28. Python's range() function

    • 29. Working with lists of numbers in Python

    • 30. Slicing a list

    • 31. Looping through a slice

    • 32. Copying a list in Python

    • 33. What is Indentation?

    • 34. Lecture 31 Tuples

    • 35. An introduction to Python's input statement

    • 36. Python's if statement

    • 37. Conditional tests with Python's if statement

    • 38. When values are not equal to each other

    • 39. Comparing numbers in Python

    • 40. Python's and condition

    • 41. Python's or condition

    • 42. The Python in keyword

    • 43. Python's not in keyword

    • 44. If elif else chain

    • 45. Multiple conditions

    • 46. Updated if with lists

    • 47. Muliptle lists

    • 48. An Introduction to Python dictionaries

    • 49. An Introduction to Python dictionaries Part 2

    • 50. Python in operator

    • 51. Get method

    • 52. Editing values in a dictionary

    • 53. Looping through a dictionary

    • 54. Other ways to loop dictionary

    • 55. Using Python dict in list

    • 56. List in dictionary

    • 57. Input prompt 2

    • 58. While loops part 1

    • 59. Quiting a program

    • 60. Using a flag

    • 61. The break statement

    • 62. Python Continue statement

    • 63. Updating lists in a while loop

    • 64. Remove from list

    • 65. Simple property rental program

    • 66. An introduction to Python functions

    • 67. Passing info to function

    • 68. Passing arguments to a function

    • 69. Positional arguments

    • 70. Keyword arguments

    • 71. Keyword arguments

    • 72. Default values

    • 73. Return value

    • 74. Optional argument

    • 75. Return a dictionary

    • 76. While loop

    • 77. Books available

    • 78. Passengers function

    • 79. Not modyifing a list

    • 80. Arbitary arguments

    • 81. Arbitary arguments 2

    • 82. Passenger seats

    • 83. Arbitrary keyword arguments

    • 84. Importing full module

    • 85. Importing specific functions

    • 86. Function alias

    • 87. Module aslias

    • 88. All functions

    • 89. Class introduction

    • 90. Book class

    • 91. Init method

    • 92. Instance of a class

    • 93. Accessing attributes

    • 94. Calling methods

    • 95. Multiple instances

    • 96. Ereader class

    • 97. Attribute default value

    • 98. Modify directly

    • 99. Modify through a method

    • 100. Imcrement attributes

    • 101. Inheritance

    • 102. Child methods

    • 103. Override methods

    • 104. Instances as attributes

    • 105. Import a single class

    • 106. Multiple classes in a module

    • 107. Multiple classes from a module

    • 108. Import an entire module

    • 109. All classes from module

    • 110. Working with files in Python

    • 111. Reading entire file

    • 112. File paths

    • 113. Reading line by line

    • 114. Making a list from a file

    • 115. Working with a files contents

    • 116. Writing to an empty file

    • 117. Appending to a file

    • 118. An introduction to exceptions and errors

    • 119. Zero division error

    • 120. Try except block

    • 121. Handling exceptions

    • 122. What to do when a file is not found

    • 123. Analyzing text

    • 124. Multiple files

    • 125. Failing silently

    • 126. Json dump function

    • 127. Jason load method

    • 128. Storing & reading data in Python

    • 129. What is refactoring?

    • 130. Testing your code in Python 

    • 131. Conclusion & Thank You!

529 students are watching this class

About This Class

No experience in programming required. Learn practical Python skills and get up and running in Python today.

Begin your Python journey here. Over the years I have tried to learn many programming languages. Most of the time I never got past the basics. But Python is different. Python is beautifully simple and yet incredibly powerful. It's also easy to read which I love.

If you have just decided to learn programming then you have made the right choice, so take a breath. Python is very easy to learn which means that you will be through the basics and on to writing programs in a very short time.

Python is a one-stop shop.There's a Python framework for pretty much anything, from web apps to data analysis. Python is often heralded as the easiest programming language to learn, with its simple and straightforward syntax. Python has risen in popularity due to Google's investment in it over the past decade (in fact, one recent study has shown Python to be the most commonly taught programming language in U.S. schools). Other applications built with Python include Pinterest and Instagram.

This course is a step by step guide through the Python 3 programming language. You will go from a complete Python beginner, installing Python to creating your own programs.

There are over 130 lectures in this course and over 7 hours of video each one detailing a specific aspect of the Python programming language.

This course will walk you through:

  • Variables

  • Strings

  • Numbers

  • Comments

  • Lists

  • User input

  • Conditional tests

  • Dictionaries

  • While loops

  • Functions

  • Classes

  • Files

  • Error handling

  • and Tests...Phew!

Get programming with Python today and enroll now.


1. Welcome to Beginners Python 3: Hi, everybody. And welcome to on beginners Quick start guide to piping. Firstly, thank you for your interest in this course. I really do appreciate it. Now comes the question. Why? Let me answer that for myself. I have studied seven programming languages. My career on each time I've stopped just past the basics except with fightin pipe is beautifully simple and yet incredibly powerful. It is also easy to read, which I love. All of these things help make the learning curve up Iten much, much easier than other languages. Appointment Very used to learn, which means that no time at all, you'll be past the basics on learning a new valuable skill. Piping is used for many purposes video games, Web apps, business tools on, most recently very heavily in data science. This course is a step by step guide. True, the pipe entry programming language. Each lecture is built on top of the last on almost every lecture contains a program for you to try in the past. The reason why I have failed to learn a programming language is because I did not stick at it. You will not have that problem. Not only is Spuyten quick and easy to learn. You also have me as your accountability body that that might sound like hogwash. But believe you, me, it is valuable. Ask me anything. Some. Your code samples venture frustrations. When you get stuck on, you will get stuck and keep in contact, because the best way to learn the program is to practice on Talk about it semi a Q and A whatever it might be getting contact and in return, I asked her only one thing. Stick at it, even if it's just one lecture a day stick at it. Pipe has not learned by observing, but by doing so do the longest. Lecturing. This course is around 10 minutes. So when you don't feel like programming, ask yourself. Can I spare just hand minutes? So let's not waste any more time on Let's get started. Thanks for listening, and I'll see you in the next lecture 2. Skillshare 101: Getting the Most From This Course: Hi, everybody. In this short video, I'm just going to give you some tips and pointers on how to get the most off the course when watching it in scale share. So here we are, open on piping step by step. Now, this could be any course, because the settings throughout scale share our standard for any course. So it doesn't matter what course you are looking at. This tutorial will still be relevant. So way over here in the viewing window, on the bottom left hand side, you can see a speed icon, so if you click on that, you're able to adjust the speed Oprah down. And that's the playback speed, the voice speed. So if you find in some of the lectures that I'm talking about, slow or you just want a quick recap, you can always up to speed. Next to that, you have a 15 2nd rewind button, which is handy if you're kind of struggling with a concept or with a topic, and you want to rewind a couple of times, which I often do another courses just to make sure that I get the point and I get the lesson over here on the right hand side. You conceive you all notes now, not all of my lessons, but some lessons will have a view note option. So, for example, in lesson number Tree How to install piping You can see here view notes, and I have a note here and have to install Platon, particularly on Windows. It's liberties. You're on a Mac. So this note is relevant to Windows users, so you can see there. It is a full note on how to install piping and have to get up and running with some caveats in Windows next to the note pin, you can see the volume button with the self explanatory volume. Up and down on next to that is the full screen toggle on enough. If we scroll down a little bit, you'll see here the community button. So we click into the community on 68 Means has been 68 questions asked and answered. The questions are varied from very simple things, like what is the print statement to very complex things and very complex questions on the pipe and language and structure? But chances are any question that you might have will be in the community section, so I encourage you to have a flicked through it. Maybe do a control on F unsearched for a topic or a keyword that you're looking for now. Every month I launch a student challenge, so June Student Challenge has just finished. So we going to project and resource is you'll see here start of the June challenge. So if you're interested in furthering your scales after you've finished the pipe, of course, or any one of my other courses, you can check out the projects and resource is and see if there's a student challenge going on there now to keep up to date under projects and Alan Challenges or any updates on might release the course. I encourage you to click Follow on, follow me so you can see any updates on new items that I might issue. One of the most common questions that I get in the community section is the question asking me is too cold throughout the course available to download while it is. And if you go to get Hub and Sarah for T Staunton, which is my user name, you'll be able to see all the courses and all the code that I have running. So here are several courses you can even see their to student challenge. You'll be able to find the code in there for the student challenge. But for this course piping beginner's guide, There you go. Section two, Section 345 All the code is in here. You're able to browse and download if you want to make your own modifications. So I encourage you as you're setting up Iten on as you're getting started in the course to visit my get home page and download the project files now. One final thing. If you are taking one of my courses on, you are enjoying them, which I hope you are. Please. If you feel so inclined, leave me a review or some feedback on how we might improve the course or improve your experience within the course. That's it. I hope that was easy enough to follow. Thanks for listening, and I'll see you in the next class 3. Topics covered in this course: Hi, everybody. I'm welcome to this course. First, let me thank you for purchasing this course and showing an interest and learning the pipe country programming language in this brief lecture, we're just going to outline what you're going to learn to read the course. So we kick off the course with variables on Indus Lecture. You learn to store information in variables on work with text, a numerical values. Next, we're going to look at strings on what our strings, but a sequence of characters. And we're going to look at how to use and manipulate them. Following that section, we look at numbers. So have the compare numbers to see if they're equal are not equal to one another on how to create a list of numbers. Following that, we look at list which had a workhorse of pie eaten on form. Many of the fundamental parts of your programming this store as much information as you want and one variable allowing you to work with that data efficiently. You'll be able to work with hundreds, thousands and millions of values in just a few lines of court. We then move on to conditions which help you to control the flow of your programs. So what happens of user goes one way or another way, which your programs what to do? Your programs do. Next. We look at dictionaries and dictionaries, allow you to connect different piece of information together, like lists. Dictionaries can contain as much information as you need the store. Then we'll look at the user input, gathering input from your users to make your programs more interactive and fun. Next, we look at loops, which allow your programs to repeat certain blocks of code. Following that, you're right functions, which are names blocks of code that perform a specific task and can be run whenever you need them and shared with other programmers in classes. We movinto Object orientated program classes allow you to model real world objects such as dogs, cuts, people's cars, spaceships, whatever you want so that your code can represent anything real or abstract. Then we move into working with files. You'll be able to store data so that when your program closes, you'll be able to read it back into your programs again. Next, we look at how to handle errors on what happens if your programs crash unexpectedly on how to avoid that. Then we look at tests writing tests for your code to help check your programs work the way you intended them to. As a result of this, you'll be able to expand your programs without worrying about introducing new errors or bugs. Testing your code is one of the four skills that will help you transition from beginner to intermediate programmer, and they are the main topics covered in this course. Thanks for listening. And let's get started with setting you up with fightin. I'll see you in the next lecture. 4. Install Anaconda, Python and VS Code on a Mac : Hi, guys. I'm welcome to this lesson where we're going to be discussing and seeing or demonstrating how to install on the conduct and fightin on a Mac. So as you can see on my desktop here I have my terminal open and open the terminal. Simply go on a Mac, go into your finder, go to applications scroll all the way down to the and until you see utilities double click that. And here's time. No, Here it's a double click time. Noto open. It pops back. Open here now what you might do as well because you're going to use terminal a lot when you're programming or as a coder. So down here in the dark, right click terminal options. Now you can see here I have keeping duck tick. So take that and your terminal is always gonna pop open down here in your doc save you have no back into utilities folder every time. So here I'm here now in the terminal. So that's for a see what variation of piping I have onto that Simply type fightin space hyphen. Capital V. Okay, heightened varies in 2.7. So an older version, so as you can see the Mac comes installed with an older version of piping, so we don't want to use very in 2.7. We want to use the mortar Modern, a newer version tree, and it could be 3.7 at this stage of 3.8 or 3.9, whatever it is. By the time you get to this lesson now, in the lessons to commandeer skill share class, you'll notice that I'm using sublime. I'm upgrading this class at the moment, and as I do, I've stopped using sublime. I'm now using Anaconda on another text editor, and you'll see why, as we install on a condom before the moment that's focused on installing and a condom on how to use it. So to install Anaconda, go to your Web browser. Let me go there now and simply type in Anaconda into your search bar on the 1st 1 that pops up for me. Anaconda, the world's most popular data science platform. Click that on here we are now. You might be thinking to yourself, you're not gonna do data signs that's OK on the conduct will automatically install piping on a number of other very helpful tools. So even if you've never gonna do data signs, it's still go to use Anaconda. So along the top, the first item is products hit, individual edition and download. No, we're on a Mac 64 bit graphical installer. So take the one that suits you. But my recommendation would be to use the graphical installer. So let me download that. Now, the following the following window pops up and you can do with this as you like, create an account, watch a video tutorial or read the documentation. I'm not gonna go true that now, but feel free to do so on your own time. Now, it's going to take a few minutes to download Anaconda because it is a pretty large file. So, as you can see in the bottom left hand side of my screen six minutes left. So I'm gonna pause the video and come back to you when it's ready. See you in just a moment. Okay, guys. So here we are back. And as you can see in the bottom left hand corner, the installation has finished. So let me click on it. So as you can see your prompted to run a check to see if the program can install. I'm gonna click. Continue. Continue again. Continue. Agreed to the license. I agree. I'm going to leave it in its default location and stole. But in my password and the installation has begun. Depending on your machine, the insulation can be pretty quick or a con. Take a few minutes allowed to access your downloads. Folder click. Ok, now you can see this message here asking if you want a free trial of pie charm on Anaconda integration. I'm not going to use that. So I'm just gonna click. Continue. Summary. Everything looks OK. Close move my download file to the been I don't want to take up disk space. So Anaconda has now being installed. So where does it go? We'll jump into your application list. Let me do that now. And as you can see here, Anaconda Navigator. So click. That doesn't take a moment to open up. No. When you first open Anaconda, it'll ask you if you want to send some stats back, that's totally up to you. Whatever you want. Now, here we are on Anacondas home screen. And as you can see, several items have been installed on are ready to lunch. So what have we got? We have Jupiter lab. We have Jupiter notebooks. We have a console application on we have Spider, which is a data signs I d. E on the left hand side of Anaconda. You see home on Environment Click Environment. Now we're going to get into environments in a later lesson. But this is just to give you an idea. Here, you can create as many environments as you want on environment. On your machine are sandboxes. So their areas or folders that you and stole or you create and you can work in so you could create a new environment called test one. On in there, you could have a version of piping. You could install libraries. You can stole files. Whatever might be on it won't impact your base installation of piping. So it's always a good idea to work in a virtual environment. I will see you have to do that later on. It was a moment. Let's go back to home now. You second time here or the second square here is Jupiter notebook. And as you can see from its description, it's a Web based interactive computing notebook. Now a lot of data signed us are using Jupiter Notebook. I have to say it is a fantastic tour, So let's launch that and take a look. Okay, so here it is. And as you can see, it gives me a folder structure. But what I can just do on the right hand side here, it's simply create a new piping trait notebook. Now, in a later lesson, we have dive a little bit more into Jupiter notebooks, but it's just go to know that you can start coding piping right away. So prints Hello, hit, run. You can see the output directly on screen in later lessons. We look at this in a little bit more detail, so now you have Anaconda on Jupiter notebooks installed and, as you can see here in the right hand side were running piping trait. So we're running Anaconda with Fighting Tree, even though under Mac we're running piping 2.7. It's just double check that version again. Yet 2.7. So I was mentioned at the beginning. Anaconda installs pipe along with it, so very helpful. Now let's discuss the cold editor that I'm starting to transition into which is visual studio code. Let me jump into my browser. So across here at the chrome, here we go. I simply typed in Microsoft Code. First thing that pops up visual studio code. Click on that now code. Everything redefined. There's all the highlights of it that's download from Mac. We'll give that the moment. Download and come back. Okay, so once again, bottom left hand side A download has complete and we click it open. Here it is. Let's run it! Okay, Visual studio code Now to get visual studio code working with Titan, we need to install the pipe extension. So as you can see here, tools and languages installed support for various languages. But the second here listed is piped. Click on that so you can see here down the bottom, installing additional support for fightin. Let's have a look. This bottom left icon here is extensions. Click on that. OK, Piper is installing. So this is the one that we want. We want the Microsoft extension for piping. Now it's being installed, so here it is. Here, As you can see, it's had 22 million downloads. This will allow us to run piping within visual studio code. And for more information, just simply scroll down here and you can see the quick start guide. Now we've installed the pipes Interpreter via Anna conduct. So that's what we can use. And how do we do that? Well, as you can see, here in the bottom left, it's time you to select your pipe and terrible er by clicking on the status bar. So the first thing we need to do is create a new pipe fire or open up pipe fire that we may have saved somewhere else. Semi closes Win the World Open New flight A folder, New untitled file. So let's do it as command the new. Here we go, Let's say file save as what we want to save it. And I want to say, but test 01 it's gonna saved on my desktop, so I'm just gonna save it here on my desktop. Make sure you give it Duck P. Why extension? Otherwise it's not gonna run correctly. Very important that you ended with Doc P y say that now, as you can see, we got a whole host of messages and that's OK. We'll take them one at a time. So the 1st 1 that pops up you may or may not get this depending on your Mac set up. So if you do, and sometimes this happens with new Max, fightin Tree Command requires the command line developer tools. Do you want to install that click install? Except that There we go. I'm going to let that run. Obviously, I'm not gonna make you sit here for seven minutes. I'm watched this blue bar move slowly across the screen, so I'm gonna pause this and come back to you in just a moment. Okay, guys. So here we are. Back, as you can see itself For what? Installed click done. Okay, So we're still here in visual code or for no one. I'm just going to say code or Microsoft Code. And as you can see, where inner test 01 dot p WiFi no one error messages disappeared or one information that disappeared from the bottom right hand side. Let's take a look at the force one here or the one on top. You selected the Mac OS system install of pipe, and that's not recommended. That's OK for the moment, because if you look over here to the bottom left off code Microsoft Code. You can see here quite in 2.7, which is the one that we saw at the very start to this lesson and the one we don't want to use. So here in this box again, you can you can select pipe interpreter and look it up. There's our anaconda or conduct install or piping interpreter. We want to use that one. All you have to do is click that down the bottom. Our pipe interpreter has changed a tree 0.8 point three. They're the one that's the one you're going to need for all these lessons. And indeed not even the lessons within this class for my lessons for running any kind of modern pipe. And you really need version, tree or both. No. The last message that we have here, Linda is not installed. So let's just install that now. If two options to install it pip or conduct as we've been using conduct, I'm going to stick with that one. Okay, that's complete. Now, let's type in some piping here. Print. Hello? You can say that with commanding s over here in the right hand side, you'll see a green play arrow hit that, and a file has run down the bottom. Hello. And that's how simple it is to run a file or to run a pipe file in Microsoft Code. Very simple. So every time you start the Microsoft Code, just always double check your pipe interpreter. Sometimes it can jump back to 2.7. You always want to make sure it's in this version here and, as I mentioned before, will discuss more about the different variations of fightin on how you can use them in virtual environment in a later lesson. But this is enough to get you going in the class of the com. You'll see that I'm using sublime text editor. I am upgrading this class at the moment on all of its lessons, so feel free to stick with this set up now, which is now my preferred UN recommended settle. And that is Anaconda on Microsoft visual studio code, all free to download on all free to use. So even though throughout the classes you're seeing me in sublime and you'll hear me say things like control and be or command and be to run the pipe and file. You now know all you have to do is hit this green arrow to run your pipe and code down here is the terminal. And just for some reference or an F Y I, as you can see here, it says base at the start of our terrible line or a command line here and that means were in our base environment. So let me just pull this across here, shrink that window down environments means putback, opener code. So we're in base and that's the base or the default environment of Anaconda. We can create more and we will do in the later lesson and then all pop up here. And indeed, we could navigate into them from our terminal. And that means that anything we do, that various environment won't impact or effect our base environment a little bit confusing . But when you start using virtual environment, they really will become second nature and you wonder how you ever lived without okay guys, you've seen how to download install Anaconda. You've seen how the download and install Microsoft Visual Studio code. And as I said, this is now my preferred development environment. So go ahead if you haven't already and set all that up and then I'll see you in the next lesson. Thanks for listening. 5. Install Anaconda, Python and VS Code on Windows: Hi, guys. Welcome to this lesson where we're going to look at and demonstrate and discuss how to install Anaconda and pie eaten on a windows machine. So the first thing you need to do as you can see in my Web browser here is go to anaconda dot com. So type that into your browser. Whatever that maybe I'm head there now. The top left hand side, you can see products hit individual edition, then just scroll down slightly and click Download. Bring it to the end of the page. Select here. Windows. Obviously your operating system select whichever one suits your system. 64 bit are 32 bit, so I'm going to select 64 bit graphical installer. Get this pop up. You don't have to do anything with that. If you don't want to. Just close that and I'm going to save the download file. Now. This is gonna take a few moments, so it back to you in just a minute. Okay, guys. So here we are back. And as you can see down the bottom, my download has been completed. So let me pop open the folder downloads. Let me double click it. Okay? Here's the set up. Welcome to Anaconda version Tree 64. Bit Click. Next. A great of the license. Okay, so it's just for me. This may depend on your system set up. For the moment, it's just me. I'm not going to change the location. So users Tony Staunton, Anaconda Tree. That's perfect. Hit Next here. Add anaconda to your path environment Variable. I know it turns red. It looks live. It's scary, but it's okay. What this will know you do is run and a conduct and conduct commands from your command. Prompt. You can see here down the second option register Anaconda Tree as my default piping 3.8. So what this will do is allow water programs such as piping tools for visual studio pie charm. I d es Pi Dev, and so on and so on. The automatically detect Anaconda as your primary version of pipe. That's exactly what we want. Hit installed, our installations being completed, as you can see here completed our status. Byers Green hit. Next. It gives you the option to use pi charm or free version or free trial version. Pie charm That's up to you. If you want to use that or not hit next. Now give you two bookmarks, Anaconda Individual tutorial on land. More about conduct. I don't want to use them. Just gonna take them and click Finish Perfect Anaconda has been installed. How do I know? Then we hit my windows icon down the bottom left recently added Anaconda Residency Anaconda Powershell as well. So that's open up Anaconda or Anaconda Navigator Just like just a moment of load. Okay, so here's the Anaconda Navigator. As you can see, the first pop up screen do you get is asking you whether or not you want to Sand stats back the anaconda for troubleshooting. I'm just gonna one click that Okay, Don't show again. There we go. So as you can see, Anaconda comes installed with several applications and each one of them here said to these don't squares. Now the next thing we want to do is download a development environment and for our purposes , I'm going to use visual studio code, which is the free i d from Microsoft. So back to my Internet Explorer Here I am. It's gonna type in visual studio code. Here it is here, the 1st 1 that pops up. Visual studio code code. Everything redefined. Click that don't know for Windows. I'm give that a moment to download. Okay. Or download has completed. Let's open up the folder. Here it is. Here. Double click it to run it except the times in conditions. Next, I'm not going to change the install location. Next. Create a short could. Perfect. Asked me if we want to create desktop icons. I'm not going to change any of the settings here. And finally insult. Okay, there we go. A nice quick install, as you can see Lunch visions. Duty was tick. So let's do that now. Click Finish. Now, here's visual studio on What we need to do is install pipe or the pipeline extension. So bottom left hand, I can hear thes tree squares. Thestreet cubes would won't lose here. Extensions. There you can see. Look, first on hair pie eaten installed. Click this little green install button. Here, give that a moment of work away. Okay. When the little green button changes to look blue button, you know Piper is being installed. You got a little information message down here. Just click. Got it. That's OK. I'm going to close this window. I'm gonna come out of extensions. What I want to do is create a new heightened file. It's a file. New file. Let me just expand this window to make a bigger There we go. Perfect. So let me type in a small bit of pipe print. Hello? There we go. Nice and simple. Then he saved this as a pipe and file file. Say, that's for the moment. I'm just gonna drop it on my desktop. I'm just going to say that as Hello. Stop, Ey save. Okay, you can see that visual code. Recognize it as a pipe and file on. The syntax is being highlighted Over here in the right hand side, you'll see this little green arrow run pipe and file internal click that There we go down the bottom. Here, you can see our terminus popped up on by clicking the green play arrow. Her file has run on an output print. Hello has been successful. Now, something to note. Down here we install Anaconda, which came a pipe in version 3.8. And as you can see in the bottom left hand side Ah, visual studio code pipe entry 0.8 point 3 64 bit base conduct. So that's our pipe interpreter. What that means is, every time you run a file or a pipe and file, it's gonna use piping version 3.8 point tree. Now, you can change this. If you have other versions of piping installed on your system, just click it and you'll see here. If you have three or four or five very since piping installed, they'd be listed here. And you can select which one you want for for our purposes. It's just the one. Where is a 3.8? Click that? There we go. Now I'm gonna close this I d my Shrink it down, I should say, I'm gonna pop back into Hannah conduct. Here we go. So something we're gonna discuss later on is how to create virtual environments. I'm very to environment allow you to set up new environments or sandboxes where you can create programs in an isolated way, which means that anything you do, such as installing a library or a new program will only impact that sandbox for that very to environment. It won't impact your base installation of fightin so you install is always safe and always running. Okay, guys, that if it is lesson we've downloaded on Insult Anaconda on Deep Iten on we've downloaded installed visual studio code and we know boat are working because we were able to run a very simple pipe file. Now, as you move to adolescence to common this class, you'll see that I've been using sublime text editor at the moment I'm upgrading this class or updating the lessons in this class to use the set up that we've just seen on a condom with fightin on visual studio code. So although I'm using sublime in the lessons to come, they will eventually be phased out in favor of this new development environment. So don't worry about seeing sublime. The code was still work in our new set up that we just run through. You'll just be looking at in a different development environment. I hope that makes sense and have any questions. Please don't hesitate to reach out and contact me. Thanks. And I see you in the next lesson. 6. [Old] How to install Python: Hi, everybody. And welcome. In this short lecture, we're gonna briefly discuss help install piping on both windows on Mac OS X. So I'm using a Mac. But so what you do is you go to piping dot org's w W dot piping dog. Here you are here, and then you click downloads. So, as you can see under downloads, it's identified that I'm on a Mac and I can select pipe and 3.5 point two now. Don't worry if that number is higher than what you see here, because it may have moved on by the time you've purchases. Course. Once you click piping, 3.5 point to the download will begin, and you can then install it as an your application on the same works for windows you downloaded and then you install it. It's annular application. So once you have downloaded Pike, you can check if it's installed by doing the following. Go to your term notes. So in Mac, I got to my launchpad and I type in terminal. There it is there, and I can type into my terminal fightin tree. There you go. Now you can see my pipe. Country is installed. I'm working and you can also use this now as a quick editor wouldn't piping So one plus 12 There you go, quick Fightin editor. And it works. Say, mom windows. When you're in your terminal windows, you type in piping on. I think it might be hyphen V for version, So piping tree hyphen V But you might want to check that now when you have downloaded fightin. One of the things that it gives you is the I D l E, or, as I call the Idol interactive development environment. So let's just go into that. So again I go to my lunch part and you can see idle here and the same on Windows Idol will be installed as an application, and you can click on it to run it or search for it and then run it. So here we have it here, Idol and again. This is an interactive development environment, which means it gives you instant feedback. So one plus one to print built in function print let you know exactly what it is. It's a built in Biden function, so that's Platon installed on running away. No, you can use idle for a lot of the programs throughout this course on the way to build an even bigger program is within Idol, say, file. You file and you get a working filed here and you can begin to write your code, save it and run it on the way you run. It is you go file on Ron Module. But we explain that further on in the lecture. Now in the lecture, you'll see me jumping Be true Idol on my code Editor of Choice, which is sublime. Here's my sublime interface here. So you can see I've got actually two programs open from the course now throughout the course will see me jump from sublime into idle on from Idol into sublime on Why is that? Well, sublime is a great text editor. But what it doesn't do is it doesn't allow you to enter user input. So a lot of our programs are gonna ask the user to input such things as their name, their address, the phone number, whatever it might be. You cannot do it out in sublime, but you can do it in idle, so I jump back and forth between sublime and idle. But I do recommend sublime because of the very quick, Very easy installed. Often I D e. That's my set up environment. Thanks for listening, and I'll see you in the next lecture. 7. An introduction to Python variables: Hi, everybody. And welcome back this lecture. We're going to be discussing variables. So what exactly is a variable? Well, a variable is a name that represents or refers to value. So simple example is name equals on whatever your name is in this case, Tony for myself. So now we just created a variable called name and we've said we've assigned that variable the value. Tony, let's change this example by typing the following first name equals Tony. Last name equals you can do the same for your name. You can change the value of a variable at any time. Pipe will always keep track its value. So here's some pointers when you're naming your very both very real names can consist of letters, numbers and underscores. They can start with a letter or an underscore, but not a number. So, for example, the variable name name one is valid, but the name one name is not valid. You cannot start a variable name with a number very well. Names cannot contain spaces, so use underscores two separate words Have I've done these two variable names above and always remember to keep your variable names Sure under script. Now that we know what a variable is and have to assign a value to it. How do we see what we've done? So how do we get our first name and last name variables out on your screen? Well, to do that, we have the following lines. Prince, which puts to your screen enter into variable name first name, um, print last name. And you're very one name. Once you have that done, if you're using sublime like I am in a Mac, you can press control and be that runs your program. And as you can see, down on the bottom left, we have Tony Staunton on the amount of time to talk to you on that program. That's a simple introduction to variables. Now it's time to try it yourself in your code Endeavor of choice. Creative program. We just signed your first and last name to a very book. Then at the Prince statement, output the values of your very Hopefully you can get that working and have any questions. Please do not hesitate to ask and I'll see you in the next lecture. Thank you. 8. An introduction to Python Strings: Hi, everybody. And welcome back. Now, In the previous lecture, we assign values to a variable. So just to refresh your memory, this is the variable name and this is the value with in double quotes that we signed to it . So we know what a variable is. But what about the tax under you decide? What about this text here? Wouldn't double quote Tony Stones. Well, this text is called a string, and that string has nothing got to do with it. The string of your guitar string of your bow or a new type of string Order down a string within pipe. And when we use the term string and piping we referring to a string of characters. So the main use of strings in piping is represent bits of text like my name here you can use single or double quotes of. We've, as we have done here around your strengths. So equally we could have done this and this would still be followed on piping what still run it within your programs. This flexibility also allows you to use quotes and apostrophes within your strengths. So let's say that we have a quote from a movie or something like that that we would like to put into a strength so we would open with double quotes, and then our quote within that line would be single quotes. So let's take a look at how that would look. So let's start with our variable, which is movie and oh, I eat movie life and we're going to sign a sign that the value, which starts with a double quote. What film is this? So we're putting a question mark on that. We're gonna put in the quote from her movie. We're going to start that with a single quote. So here we go. Show me that money. So there we go on, we close it again with a single quote. And as you can see here, we still have our double quote closing our overall string of text. So, like I said at the beginning, this entire line is a string of text. It opens with a double quote. I went in there line. We want to emphasize our emphasize or quote something so we have that opening with a single quote and closing with a single quote. And then overall are string of text closes with a double quote that works both ways. We could have just as easily done this. I take this out and I take this out. I can start on end this example with a single quote, but what I need to do now is I need to just change these around three double quotes. Let me just do that now. Here we go, double double on a single to wrap it up, so piping doesn't mind which one to use. It allows for flexibility on dis Affleck, and this flexibility, as we've just seen here, allows you to put emphasis within your quote would in your string of characters. Let's take a look at another example if for some reason you don't like double quotes, you can still use a single quote method. But any single quotes with in your string will need to be escaped with the Backslash character on that goes like this. So we have our variable start equals, and we opened with a single quote, and now we have the word let's but we can't write that. That's what we need to do Here is we need to escape this apart. This single quote with a backslash like that. So let's get started with python on. We end this with a single quote. So as you can see here, you can you can use single quotes to open and close your strings. But if you're going to use a single quote with inside, you need to escape it with the backslash character. So this is being a nice, simple introduction into strings. In the next lecture, we're going to look at other ways to use strings within piping. Thank you, and I'll see you in the next lecture. 9. How to concatenate strings in Python: Hi, everybody. And welcome back in the last lecture, we got a nice, simple introduction to strings. Are we gonna continue? Continue to build on that introduction throughout the next few lectures. So in this lecture, we're gonna be talking about concoct in ating strings. Now, if you're anything like me, you have to google what concocting it means. And if you did, you're not alone. Because when I, for a start learning programming languages, so did I. So let's just take a quick look. I want concocted nation means concoct innate means to link things in a chain or Siri's. Put simply, it means to combine things on. That's what we're gonna be doing in this example. We are going to be combining strength. Ah, here you say. But why can't I just type in a full sentence, full sentence or string of characters? Well, that's a good question on Let's take a look, starting with our previous example. So we entering our variable and we enter in the name so you can put in your own name here. Okay, so we have a string on the string Is my name Tony's? Don't. But what happens if I want the output to my program, my forest name or my last night. We might be working with a piece of software where it says Hi. Your first name So high, Tony, Welcome back. Or you might be writing an email template. And it might be it might be Dear Mr. And in your last name. We can't really do that here because this is all one strength and piping doesn't know which is the forest name on which is the last name, the piping. This all just one strength. So how do we do that? How do we give it individual first name and last name? And then how do we combine them to make a full name? Well, let's take a look. Let me get rid of that. We'll start off with first name. That's our first variable equals Tony on our last name. Equals started. Okay, so there we go on later on. The lecture will be talked about. Have to receive input from her users. But for now, we can just imagine that we have a piece of software. We haven't interface on the Web that has asked for a user's first name and last name. So suppose we're building a piece of software that needs to store the first and last names and separate variables like we have just here that piece of software my dad need to combine them to display your phone name. So think of your signature in an email program when you log in. It might say hi, Tony, and might welcome you back to the software. So how does that happen? How do we do that? Let's take a look. So when I send an email, it might are depopulate my forest name in the opening signature. So print. So imagine this is in your email software program and we open up our double quotes on we say hi. We leave a space and we quote closer double quote. We then enter in the plus symbol when we enter into variable first name. So there we go. What's gonna happen there is that we're going to get the message high on a first name in this example. Tony, what about if we were doing a more formal kind of email print and we open up our double quotes again here, I believe that we leave space. They're closer. Double quotes, use a plus symbol again, and we have a last name. I've actually just left out one small piece here, dear Mr and in a space on her last name. And that's how. And that's why it's a good idea to separate things such as names or anything that might be used as an individual piece of information or data in its own variable. So we've use for his name and last name. So let's run this and see what happens. Okay, down the bottom, you have high Tony on Dear Mr Started, So piping uses the plus symbol to combine strings with variables. We have just used the PLO symbol to create our welcome message using the PLO symbol to combine strings. Inp Iten is known as concatenation. Let's try another one print, first name and last name. So again, thank you for email program and it might be welcome you It might be a welcome message with your full name so high Tony Stone. And if we run this again, Okay, so down the bottom here you can see the full name has been printed, but there's no space between her name. So where did this space go? The space character like an iota character needs to be added in. So let's do that. So we have forest name, actually, just type of new line so we can do it again. Print first name plus. So instead of just going straight to the last name, we want to add in a space. So again we open with her open and close with our double quotes, type in a space and then add in our last name. So let's run thus and there we have it, Tony, standing with a nice space. So going back to what we said it started. This lecture concatenation means to combine things. So Inp Iten it is used to combine strings or strings with variables to make complete sentences. So I hope all of that makes sense. If not, please don't hesitate. Ask in the Q and a section off this course. And if it does keep going, try the activities and I'll see you in the next lecture. Thank you. 10. Using Python's string title() method: Hi, everybody. And welcome back the last lecture we looked at how to incarnate strings and variables or have to combine strings and variables. Now we used naming a name example in our last program lecture on What we're going to do in this lecture is we're just going to stick with this name example for a few more minutes, so just bear with me. So we have our name on our variable now, as you can see here, Each time I typed my name, I capitalized my first on my last name, and I did that just out of habit. So that's just entering a new variable for his name. And again, I usually just go like that capitalize. But what happens if I don't? So there's no way for us to know how a user is gonna type in their name. They could enter it in all cups or lower case, or they could capitalize the first initial off their name on Let's just type in last name is Well, why were at us. So again, imagine the program on the Web where you have asked a user for the first name under last name. But obviously, when you print that name back to them, you might want to capitalize their first order. Last initial, whatever it might be. How do we do that while we use what what's called the string title met it. So the title mattered and that mattered looks like this so we don't have to do anything to our current variables order values. What we need to do is work on our print statement. So we have print and let's print our first name. And then we followed out with don't t I t l e open and close brackets and that's called the Pied title mattered. And what that does is it capitalizes the first initial off this variable. So let's run this program and there we go. So, as you can see, are variable here. Tony is old lower case, but when we printed out to screen, Tony is no capitalized or the tea and Tony is now capitalized, so that is very, very handy saves you doing. It allows you to take input from the user, manipulate that input on printed out in a nice, clean format now, so let's print out a first are full name, but before we do. Let's just change the S on the T to lower case. I just go down here and we say Print name that T I t L A. Print name that title opening close brackets and make sure you close your brackets here and let's run this program again. On there we go. Perfect. Even though our name variable is all lower case, it's output it because of the title, mattered in a nice, cleanly formatted capitalized way. So let's just talk about this title method for a moment. This piece of information here dot t i t l e open and close brackets. That is what's known in pie eaten as and method. So a method is an action that piping can perform on a piece of data. So in this example, we've used the title method to manipulate the data within the name variable. So to manipulate my name here or in your example, you're name on that manipulation has capitalized the tea and yes, the dot after name in Dar title tells Peyton to make the title mattered. Act under variable name, so no good. Just adding it in. You have to remember to put into dot and adult with them to help Iten to use the title mattered on our variable name unequally when we use it on first name dot Title told Pipe to use the title Mattered on Our first name on It would be the same with her last name. So print name Sorry, Last name on Dutch, which tells Peyton to modify the last name Variable with the title method. Let's run this again and there we have it. The Staunton has become three s in the Stanton has become capitalized A very, very handy feature Every mattered is followed by seven set of brackets opening and closing . Because methods often need additional information to do their work, this info is provided within the brackets. So as we'll see later within the brackets here we will provide more information for the matted toe work with could be user input could be anything. We'll look at that later on. And that is an introduction into the pipe title matter. We will look at other mattered in future lectures. Thank you. Hope all is made sense. If not, please ask me in the Q and A. Or check out the activity section. Thank you and I'll see you in the next lecture. 11. The Python find() method: Hi, everybody. And welcome back in the last lecture, we looked at the title mattered, which allowed us to capitalize the first letter of any strength or any word. So as we know and method is an action that piping can perform on any piece of data. So in this lecture, we're gonna look at Peyton's find method. So again, we're still going to stay with strings. So let's just enter in a string here, and we start off with our opening and are closing quotes. So this string I'm gonna enter is my favorite book is single Quote cause I want to emphasize the book name Elon Musk on. If you haven't read it, give it a go. It really is an excellent on a quick read. So here we have our strength. So let's just say again we have a program and it might have a search by are in it or search function within its on. We want to find where book is within their string, or we might want to find where the word favorite is within their strength. What we can do here is we can assign this forced a variable. So let's just say my book equals. So now we have our variable on the left hand side and we have our value, which is a string on a right on. What we do here now is we attach the dot find method. Okay, It seems simple enough, but we have to tell it what we want to find. We just have empty brackets and as we sadly in the last lecture brackets, or where you can place information of what you want to find, method to do or any method to do so in this instance, we want to find a book. Be okay. Okay, so there we go. Let's see what this does for us here to get the information out to the screen. We have print my book on Let's run that Perfect today. Now, down here in the left hand side, we can see that we got a return of 12 on. Why 12? Why not the actual war it book? But obviously we need to first find where book is within our strength. So here we have my favorite book. So what 12 refers to is the position within their string where it award book starts. So when piping counts, it doesn't count 12 tree four. Instead, it starts at zero. So 01234 And so one on. The reason piping starts at zero is because it on another computer language, actually, for that matter will started zero is because it allows you to count backwards. So zero minus one minus two, minus three minus four and so on. So you have that flexibility go forwards into positive numbers or backwards into negative numbers. So here we have here my favorite book on a viewer to count out, you would see that B which is the start of book startup position or, as it's known in programming languages, the index 12. And that's where eBook starts so equally we could change this. And we could say, instead of book, we could say, Ellen, we can run this again. I'm to get position 21 or index 21. Position index 21. Okay, so how could this fine mattered be used in the real world? Well, as I mentioned at the start, imagine this was a search program on you wanted to type in, find Ellen. It would be able to give you back what position Ellen is in. How many times alone was mentioned in the search parameters or whatever might you might be ? There are plenty of ways to expand on this accent. Little method now equally have you had a program and it was going back to our old example. An email program. You could have a spam filter. So what you could make your program do is find characters that are associated with span so we could have subject as they are variable equals. And then the tight lover email. Let's just say is get rich now. So I'm sure we've all got these kind of emails and we could have that find print subject and let's see man to be. And there we go. And this is interesting. We got a value back of zero. And as I just said, piping started counting at zero. Then it goes 12 tree. So what this output is telling us is that it found our search of tree dollar signs in the very in the very beginning of our strength. So here we are. So here it is, here, on what we could do later on is we could refine our email program to remove any messages that it picks up a span, which is the tree dollar signs in this example. So that's a quick example. Off defined method and as always as we've seen in her last electric define Met start with dot F i nd brackets and inside the brackets is the argument that you want to pass or the information that you want a pass in the piping for the method to act upon. So I hope that made sense. If not, please shoot me a question on the Q and A section and give the activities go at the end of this section. Thank you, and I'll see you in the next lecture. 12. The Python lower() method: Hi, everybody. I'm welcome back in this lecture. We're going to continue our exploration off, heightens methods on we're going to talk about the lower method. So what exactly does that mean? Well, it's it does exactly what it says on the tin. So let's go back to our name. Example. So we have name and we're gonna Stafford are open and closing double quotes. We're going in. Put my name or as you type your name, we're gonna put it in in all uppercase characters like this. Tony Staunton in upper case. So let's assume someone is entered their name into your shiny new Web program. And it's all in uppercase like this. Obviously, we don't want to put that into a database or into our storage system, which may be a file like this. We wanted all the same because some people might enter their name and lower case or in my capitalize, the first initial like we saw in a previous example. So what we want going into a database has to be all the same on all the same formatted information. So what we can use here is heightens lower method. So as we've seen, what other methods we have dot L o w e or open and close your brackets. And what that will do now is it will lower the string Tony Staunton all lower case characters. So let's have a look at what we get. Print name. Let's run this program. Control a command to be if you're on a Mac. Perfect. Here we go. Here we have now down here in the bottom, right? Tony Staunton all in nice, lower characters, cleanly formatted. I'm ready to go into our database or any other file storage system, so that's a quick introduction into Haydn's lower method. To be honest, it's one of my favorite because it's very useful and it's used all the time. I hope that was easy enough. And I'll see you in the next lecture. Thank you. 13. The Python replace method: Hi, everybody. And welcome back and this lecture, we're gonna be talking about Biden's replace method. So what exactly does that do? Well, it replaces a piece of a string with another piece so it can replace one word Wouldn't know the word and we'll look at that now in a moment before us. Let me put this in some context for you. In a really world example, we previously looked at the find method on what that did waas. It finds position of award within the strength. So we had find book on A told us that books are the imposition 15. That's what we could do is think of any word processing program you have ever used. There is always a find and replace function so you could find a word and then replace the word. And this is exactly how it's done. So we previously saw have to find. Now we're going to see how to replace. So let's have a look at RM string, and what we're gonna do here now is we're going to start off again with a variable, and we're gonna call it my book equals and as always, we start offered opening and closing double quotes on what we do here is we have my favorite book is on a single quote cause we want to give it impetus. And let's just say we spell this Ellen with a type of instead of Ellen, we put Alum Mosque easily done. So there's a string on. What we want to do is replace. So we're using the pipe and replace mattered opening and closing brackets on. We first put in the peace of the string we want to replace. So as previously, we start with opening, closing single quotes on we have Ellen. Then we have a common to separate out our two pieces of information opening close and single quotes on. We put in what we want to replace it with. So we want to replace Ellen with Ellen and again go back to thinking about a word processor . You've made a typo on all you've written a paper on the book, Elon Musk on all true that paper. You've misspelled Ellen for Ellen and you've done that 300 times. Now you hit to find a replace function would in your word processor on. This is how this is exactly how it works in the background. So let's run that and see what we get. And there we have it in the bottom left hand corner instead of getting my favorite book is Alum Musk we have My favorite book is Elon Musk, So it works perfectly, and that really is a very, very helpful function if you're developing any kind of word processing, email or any user input program because it's always gonna be errors, when does users involved so very easily were able to replace are misspelled word with our correct word? A nice little featured her to keep on your list. So that's it for to replace Method. I hope that made sense. If not, please don't hesitate to ask me any questions in the Q and A section. Thank you, and I'll see you in the next lecture. 14. The Python strip() method: Hi, everybody. And welcome back this lecture we're looking at Biden's strip mattered, So the strip mattered. Removes any white space on the left or right hand side of your strength. So let's take a look. So let's assume that you have a program running on the Web and asked to use a further address. So let's create our address. Variable and as always, I have left out the equal signer. And, as always, we have our opening closing double quotes. And let's just say our address is one a one main street. Okay? And let's just print that out to our screen and see how it looks. Okay, Perfect. As you can see down here in the bottom left one a one main street. Nothing wrong there. Now let's let's assume and not a user comes along and they enter in 102 Main Street. But for some reason, they've also add in some tabs at the beginning on end of their strength and just to put this into a real world example. I had a user once who couldn't log into their program because at the end of their email address, they were putting in an extra white space, so they're hidden the space bear. At the end of the email address. I don't know why they were just doing it, but the error was on my side because I didn't write into code that picked up this little bit of extra white space on removed from the email address. So it was my fault. So this little matter that we're going to look at now would have solved that problem. But before we get to that, let's have a look at what we get on our output so control and be. And here we are here, down the bottom, right down the bottom left. Sorry, 102 Main Street, and you can see here that are types of being added in. So obviously, we don't want that going into our database or into our file. So we need to remove this white space, and that's where Pipkins strip method comes in. So at the end of address, we have dot strip opening closing brackets. Let's run that again. There we go. Perfect old white space removed very, very handy. So let's have a look at another example. This time, let's assume that they have left the white space in on the left hand side off their address . So this time is being left here. We could modify strip to just be else trip as in left strip. Let's run that again. There we go, no white space. And again the same is true for the right hand side. So let's just add in some white space first to make sure that it's there. I'm printed out and on the right hand side we should see some white space. Yet there it is there on Let's modify our program again to remove the white space runs again and, as we can see no white space on the right hand side. So a very, very handy set up for a set of methods there. And they are the strip method, which removes all white space from your strength. The left strip method, which, as it sounds, removes whitespace from the left hand side, your string on the or strip method, which removes whitespace from the right hand side of your strength out the real world. These methods are very useful to clean a user input and combined with everything that we've seen so far, should help you to take user input, strip it down, clean it up on, have a nicely formatted into your database. I hope that all of this made sense. And I look forward to seeing you in the next lecture. Thank you. 15. How to add new lines and tabs in Python: Hi, everybody. And welcome back in this lecture, we're gonna be talking about adding white space. So we've seen have removed white space. How about adding it back in, such as a new line or a tab? So adding a top, it's simple enough, and this is how you do it that stick with our address. So we have our variable address equals opening, closing double quotes, one a one Main Street. And then let's just say we want to add in the area where that might be, such as to county or the city or the province on. Let's just say if you're in Dublin like I am back slash t adds in a tap. So we have back slash t Dublin and that's just print our address and run that on. There we go. Bottom left hand corner. We can see our address. One a one Main Street Tab Dublin. Simple enough. Let's look at doing that with a new line. So again, address equals opening. Closing double quote one or two Main Street. And instead of adding in the time we want to add in a new line, Dublin and let's just print our address again. Print opening. Closing the world brackets are address on Let's run that. And there we go one or two Main Street, Dublin. Perfect. So that's a very quick explanation as how you add in a tab or a new line into your strings on your programmes. Thank you, and I'll see you in the next lecture. 16. Working with integers in Python: Hi, everybody. And welcome back. Now we're moving into a new section. Now, on this section is all about numbers in piping. So, as you can see here, I've moved into my ruby I d. E. So the Ruby Interactive interpreter And the reason I've done that is because we want instant feedback. I'm gonna show you how to work with numbers and fightin. We're going to be adding, subtracting, multiplying, and we just want instant feedback. So we're gonna look here. So when it comes to programming, numbers are everywhere. Video games, charts and graphs, information, storage, analytics on and on. Numbers are absolutely everywhere. And even in today's world, I'm sure you've seen that numbers are even more important when it comes to big data. Big storage and things like that so really is valuable to get a good foothold in numbers within your programming language. So let's take a look at some quick examples. It's a pop. Open the interactive pipe interpreter and try to following to plus two, four straight away. Very simple. It's what we just did was add to indigent numbers. On integers are whole numbers. Let's try another example five minus tree. Sorry tree to perfect on another example. Tree times tree nine. Everything working as we expect. So now let's divide two numbers. So that's divide six by two. And I'm leaving space in here between the characters just for clarity. But you don't have to do that. So six divided by two is tree. Now what about exponents? So Inp Iten exponents are represented by two multiplication symbols. So we have three Sorry tree exploding 3 27 or, if we do five 3125. Simple enough. And then, as we get into a little bit more complicated, Livermore structured number sequences. What about the order of operations? Will piping supports those as well? So if we look at this example, two plus three multiplied by four. And as I said, you don't have to leave spaces between your number symbols. There we go. 14. You can now use brackets to modify the order of operations. So let's have a look at the US Here we go. 20. That's a very brief introduction into the numbering system and order of operations within. Fightin in the next lecture will look at floats on what our floats wouldn't fightin. Thank you. And I look forward to seeing you in the next lecture 17. Working with floats in Python: Hi, everybody. And welcome back in this lecture, we're gonna be looking at floats within the piping language. So any number with a decimal point is called afloat on Why is it called us? Well, it's because a decimal point can appear at any position in a number important. If any number in your calculation is afloat, then the result will be too. So let's take a look at some simple examples. One plus 1.0, both have the same value. Let's have a look at the road. Put 2.0, perfect two point. Oh, multiply it by 3.0, 6.0. Perfect. That's do division 0.0 divided by 2.0 1.5. Very good. So sometimes you can get arbitrary number of decimal places. In your answer. Let's have a look of what that looks like. 0.2 plus 0.1. There we go. And that's just one of those things that pops up from time to time in piping on other programming languages. For the moment, just ignore the extra decimal places on with the Scots have to deal with them later. Thank you. And I look forward to seeing you in the next lecture 18. How to convert numbers to strings: Hi, everybody. And welcome back in this lecture, we're gonna be talking about how to convert numbers. Two strings and we're also going to combine some of some of the things that we've learned over the previous lectures. So one of the most common things to do not just imp Iten button any programming language is to use variables within a message. But what happens when the variable is a number? Well, let's take a look and see. So let's start off with her name. Single opening, closing single quotes. Tony does title to upper case that when we need to. Now let's put in our date variable. So date today eagled now because we're putting in a number we don't need to surround out in opening. Closing quote. Single or double. So today's date 24. And now let's pretend a welcome message to ourselves. So welcome. Now let's use concatenation here to combine the couple of variables that we've created. So let's start off with our opening closing double quotes, high space plus name. So what inserts are name Plus now without in our welcome message. So opening closing quotes Welcome back today's and we can use a single quote here because we've opened this piece of string with a double quote. I'm going to close with a double quote, as you can see here. So welcome back. Today's date is de now concoct. Innate on we add in our date today. Variable day today, plus opening, closing double quotes, Space of October and there we go on, Let finish this offered with Prince Statement now. So we're telling piping to print out our welcome message and let's have a look at that. Well, as we can see here are welcome message once again is high plus our name variable, which is Tony. Then we have our welcome message. So plus, welcome back. Today's date is D plus day today, which is 24 of October. So let's print this and see how it runs. We can see down here in the bottom left hand corner. The computer has said no. So if anybody is familiar with the comedy sketch show in the UK Little Britain, you will know this by heart. The computer says no. No matter what you do, you gotta know. So why has the computer said no well, down here in our era message we can see that we can't convert an integer which is our value 24 into a string. So what piping is doing here is that it expects today's date to be a string. So we expect piping to insert the variable day today into our strength. But instead it gave an error. So in this instance, plight knows that we have a variable with the value of 24. But what it doesn't know is how to interpret that value to Parton. That variable could be either doomed you numerical value of 24 or simply the characters to on four. When you want to insert indigenous into a string, you need to tell Platon to use the integer like a string And this can be done very simply with the S T or for string method. That method looks like this S t or on like all of the methods opening closing brackets this matata Spuyten to represent non string values such as integers as strings. So let's insert this method into our welcome message above never gonna help Iten to treat the variable date today as just any other string. Let's printer string again and there we go. And actually, I've missed the space here. So let me just add that in space on a Run it again. So here we go. Hi, Tony. Welcome back. Today's date is the 24th of October. Now Pipe knows that we want to convert the variable value off 24 to a string on display the characters to four. So that's a good example of everything that we've learned so far. Hope that helped any. Any questions. Please do not hesitate to contact me into Q and a section. And I look forward to seeing you in the next lecture. Thank you. 19. What are Python comments: Hi, everybody. And welcome back and this section, we're gonna be talking about comments, Wooden pipe. So in any programming language, there are water known as comments on Comintern. Fantastic and very helpful tool in any language, not just fightin. So what exactly is a comment? A comment allows you to add plain English text to your programs on this tax will be ignored by the piping interpreter, so comments are completely ignored by the computer, so you don't have to worry about them causing errors or upsetting your programs. And how do we write comments while Imp Iten? A comment begins with the hash symbol this. Let's Spuyten know that everything after the comment is to be ignored. So let's look at a quick example. So let's enter into comment. This is my hello world program and thats print out. Hello world print open and close brackets. Hello world on. Let's see what we guess from our interpreter. Perfect bottom left hand side hallow world. So as you can see, the two comments that we've included here are not out. Put it onto your screen on our completely ignored by piping to this leave you free ad in tips reminders on comments for order programmers to help them when reading your programming as your programs become larger and more complicated, Comments are a great way for you to insert helpful notes about piece of code or program, because when you come back to it in a few months or a few years later, you may not know why you wrote what you did. So going forward now in discourse, we're going to be adding in comments throughout our code at the side of every program and then throughout our programs, to give helpful pointers on reminders. Thank you, I'll see you in the next lecture. 20. Introduction to Python lists: Hi, everybody, and welcome back. Now we're moving into a new section on that section is entitled lists. But before we jump into lists, let's talk about a new concept for a few moments. On that concept is data structures. A data structure is a collection of data elements, so those numbers are characters that are structured in some way, such as by numbering them. The most basic data structure and piping is the sequence. Each element of a sequence is assigned a number. It's position or index. We've already discussed the first index started. Zero the second indexes one and so on, and so one. Let's just take a moment to talk about how numbers work once again, Imp Iten. When you countings, you most likely start counting at one Inp Iten. On many other programming languages, it's slightly different. You start counting at zero. One of the reasons for starting at zero, as we've already discussed, is because you can also count backwards. Biden has six built in types of sequences. This section concentrates on one of the most common, and that is lists. Lists are one of Piper's most powerful features on one of my favorite, so What exactly is a list? Well, as we've already said, it's a collection of items in a particular order. The items in a list are called elements. You could make a list containing anything you want months of the year. Family names, numbers, absolutely anything, because you will usually store in more than one element in your list. It's a good idea where naming them to make the names plural, such as months names, etcetera. When creating a list, you start with the name of the list. Let's jump back into a colder now and have a look. So, as I just said when creating a list, you start with the names of the list. Months equals you didn't start on and your list with square brackets. So that's opener square brackets on as we see closer square brackets, individual elements of your list start and end with a single quote. So that's put in a month here and let's go with January. So as you can see, we started me close with single quotes. When you add additional elements to your list, they're separated by a comma again, opening closing single quotes. That's at another month and another on actually here. I have left out a closing quote when we put that in and as you can see our code and it has changed the fund color off April. Now let's ask piping to print out our list of months. And as we have down the bottom left hand corner, we can see her list of months. January, February, March, April. Now it's not very user friendly. As we've already discussed, elements in the list are numbered from zero upwards. This means that you can access each element individually like this. So let's have a look in another print statement on we go print months on because we're trying to access an element of a list we open with square brackets and me close with square brackets on. We have called the first element in our list, which was January on its opposition. Zero. Now again, let's print this. And as you can see in the bottom left, the next line printed out is January not too bad, so that's a little bit more user friendly. What about capitalizing the first letter off the month? Well, we can use what we did previously when trying to capitalize strings so That's additives Line added our code again. Let's go print months and again, we're accessing Element zero, opening closing square brackets, DOT title and has always opening closing brackets. Now let's print this out. And again. We have a new line here on its January with a Capital J. That's nice. Now we have to force element in our list. Printed, cleaning and capitalized. How about accessing more than one element from her list? To do that, we can repeat our print statement print months. We want to access now the second element in our list, which is opposition.