Data Science & Machine Learning Bootcamp -- Class 1 of 10 -- - Python Essentials | Dr. Junaid Qazi, PhD | Skillshare

Data Science & Machine Learning Bootcamp -- Class 1 of 10 -- - Python Essentials

Dr. Junaid Qazi, PhD, Data Scientist

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
18 Lessons (2h 35m)
    • 1. Data Science & Machine Learning Bootcamp Class 1 of 10

      0:10
    • 2. How to be successful in this field!, few tips!

      0:40
    • 3. S:1 Course Introduction

      7:00
    • 4. S:1 Setup Jupyter and Environment 1

      9:10
    • 5. S:1 Setup Jupyter and Environment 2

      25:18
    • 6. Download Course_Material

      0:40
    • 7. Env File

      0:14
    • 8. EnvSetupOtherOptions

      3:34
    • 9. Important Note!

      0:17
    • 10. Re: Possible updates

      0:24
    • 11. S2: Python data types Part 1

      20:57
    • 12. S2: Python data types Part 2

      14:36
    • 13. S2: Comparisons Operators, if, else, elif statement

      12:17
    • 14. S2: Loops, List Comprehension, Functions, Lambda Expression, Map and Filter (Part 1)

      15:35
    • 15. S2: Loops, List Comprehension, Functions, Lambda Expression, Map and Filter (Part 2)

      19:56
    • 16. S2: Python Essentials Exercises Overview

      2:03
    • 17. S2: Python Essentials Exercises Solutions

      21:54
    • 18. End C 1

      0:10

About This Class

Greetings, 

I am so excited to learn that you have started your path to becoming a Data Scientist  with my course. Data Scientist is in-demand and most satisfying career, where you will solve the most interesting problems and challenges in the world. Not only, you will earn average salary of over $100,000 p.a., you will also see the impact of your work around your, is not is amazing?

This is one of the most comprehensive course on any e-learning platform (including Udemy marketplace)which uses the power of Python to learn exploratory data analysis and machine learning algorithms. You will learn the skills to dive deep into the data and present solid conclusions for decision making. 

Data Science bootcamps are costly, in thousands of dollars. However, this course is only a fraction of the cost of any such bootcamp and includes HD lectures along with  detailed code notebooks for every lecture. The course also includes practice exercises on real data for each topic you cover, because the goal is "Learn by Doing"! 

For your satisfaction, I would like to mention few topics that we will be learning in these 10 classes:

  • Basis Python programming for Data Science

  • Data Types, Comparisons Operators, if, else, elif statement, Loops, List Comprehension, Functions, Lambda Expression, Map and Filter

  • NumPy

  • Arrays, built-in methods, array methods and attributes, Indexing, slicing, broadcasting & boolean masking, Arithmetic Operations & Universal Functions

  • Pandas

  • Pandas Data Structures - Series, DataFrame, Hierarchical Indexing, Handling Missing Data, Data Wrangling - Combining, merging, joining, Groupby, Other Useful Methods and Operations, Pandas Built-in Data Visualization

  • Matplotlib

  • Basic Plotting & Object Oriented Approach

  • Seaborn

  • Distribution & Categorical Plots, Axis Grids, Matrix Plots, Regression Plots, Controlling Figure Aesthetics

  • Plotly and Cufflinks

  • Interactive & Geographical plotting

  • SciKit-Learn(one of the world's best machine learning Python library) including:

  • Liner Regression

  • Over fitting , Under fitting Bias Variance Tradeoff

  • Logistic Regression

  • Confusion Matrix, True Negatives/Positives, False Negatives/Positives, Accuracy, Misclassification Rate / Error Rate, Specificity, Precision

  • K Nearest Neighbour

  • Curse of Dimensionality, Model Performance

  • Decision Trees

  • Tree Depth, Splitting at Nodes, Entropy, Information Gain 

  • Random Forest

  • Bootstrap, Bagging (Bootstrap Aggregation)

  • K Mean Clustering

  • Elbow Method 

  • Principle Component Analysis (PCA)

  • Support Vector Machine

  • Recommender Systems

  • Natural Language Processing (NLP)

  • Tokenization, Text Normalization, Vectorization, BoW, TF-IDF, Pipeline feature........and MUCH MORE..........!

Not only the hands-on practice using tens of real data project, theory lectures are also provided to make you understand the working principle behind the Machine Learning models.

So, what are you waiting for, this is your opportunity to learn the real Data Science with a fraction of the cost of any of your undergraduate course.....!

Brief overview of Data around us:

According to IBM, we create 2.5 quintillion bytes of data daily and 90% of the existing data in the world today, has been created in the last two years alone. Social media, transections records, cell phones, GPS, emails, research, medical records and much more…., the data comes from everywhere which has created a big talent gap and the industry, across the globe, is experiencing shortage of experts who can answer and resolve the challenges associated with the data. Professionals are needed in the field of Data Science who are capable of handling and presenting the insights of the data to facilitate decision making. This is the time to get into this field with the knowledge and in-depth skills of data analysis and presentation.

Have Fun and Good Luck! 

Transcripts

1. Data Science & Machine Learning Bootcamp Class 1 of 10: 2. How to be successful in this field!, few tips!: 3. S:1 Course Introduction: Hi, guys. I'm Jeanette Cosy. As a mentor and research scientist with over 17 years of professional experience, I have developed this skill set in data mining analysis and mortally, while working with economic and industrial giants in Asia, Europe and North America. I have trained hundreds of students in the class. Now I'm here to teach you the most demanding skills in the world today. Which data science and machine learning data science is in demand and most satisfying. Kailua, where you will solve the most interesting problems and challenges in divorce. Not only you will get an opportunity on high salaries. You will also see the impact of your walk around you in the organization and the people you're working with. This course especially designed for you guys. This is one of the most comprehensive course on any e learning platforms which uses the power of python to learn exploratory data analysis and machine learning algorithms. You learned the skins to dive deep into the data and present solid outcomes for decision making. For your knowledge, data science boot camps are costly in thousands of dollars. Heiler this course is only a fraction of the cost and includes over 25 hours of high quality lectures, along with court notebooks, on details for every lecture and plenty exercises on real data set for each topic you will cover. So let's have a quick overview on the topics we're going to cover in this course. Even start with departure Really long Key concepts in part on essential section, we will talk about pythons, data Times comparison operators, if else and if statements, loops, list comprehension functions and Lambda expressions, map and filter and much more and the most important thing practice exercises at the end of the section to improve the skill set and hands on training. After getting hands on training on Parton programming, we'll move on to explore the data analysis capabilities in Piper using It's still off the art libraries Numb pie and turn us. Nope. I is a fundamental package for scientific computing in Pirata, whereas China's is an open source library providing high performance, easy to use data structures and did an analysis tools for python programming language. After getting a seal on data analysis skills, we'll move on to the did a realization section. The realization have significant importance in the field of data signs and fightin provides bit libraries for destabilization. In this section, we will start that Matt for Clip, which is the most popular porting library for Pitre. We will then move on to the Seaborn. It provides a high level interface for drying a collective statistical glass. We will then come back to power Notch. This time, we've been learned did a realization in partners. Panoz comes with its built in did a realization capabilities, which is very handy for quick realization. We will explore a vital variety of plotting options that comes with panels in this section . Drivel then move onto deplorably and Coughlin's for interactive and geographical plotting. You've learned that how easy it is to get interactive parts using these state of the art libraries with solid skills in data analysis and data realization, we will move on towards the Capstone project. This is your opportunity to put a seal on your data analysis and did A realization skips once again you're going to walk with zeal data sets in Capstone products after getting a seal in data analysis and did a realization skills using python. We will move on to the machine learning part machine learning is one of the most important skill in the field of data science. We're going to use the state of the Art Machine Learning Library in Pirata, which is psychic long. We will explore range off machine learning models. In this section, we will talk about linear regression logistic regression can nearest neighbors, which is cayenne decision trees and random forests. Support factor machines came in clustering and principal component analysis. I want to mention that it is very important to know the terry behind immortal aspirin, so each machine learning section will start with detailed theory, lecture and working principle behind the moral. After a theory lecture, we will move on to the Jupiter notebook for hands on training, using real data projects. At the end of each machine learning model, you will practice your skills using additional real data projects, so each model in this machine learning section will involve at least two really later products. Once again, our focus is your training and to provide you the range of carrier options. For this reason, I have added couple off additional topics. In this course, you will learn how the recommended systems walk with Real did a product. We will also explore the nature language processing using another very important library in python, which is N L T K. Once again, using real data sets and hands on training with design is a commander systems and clean our moral using real data in NLP section with every additional topic. It Terry lecture is also provided for you to get a better understanding off the topic. So this was a brief interaction. What are you waiting for now? Join me in this course to become a data scientist, you got an opportunity, the fulfill your dreams and all handsome amount of money. You're going to learn the skills to make the difference in the society using the power after data. This is a job ready course for you. And I'm so excited and looking forward to see you in this course. Join me in this exciting journey, seeing the next lecture where we're going to do the real data science. Good luck 4. S:1 Setup Jupyter and Environment 1 : Hi, guys. Thank you for enrolling into my course. I am sure that you will enjoy the journey to learn the data size with me. If you have any questions, please feel free to post in question and answer for. So the first thing is to get the system running for walk. Let's move on and learn to set up the working environment for this course. In this lecture, we will walk through the stacks and all the things we need to have installed on the computer. In this course, I'm going to use Jupiter Notebook for teaching purpose all day. According exercises and lectures are provided in the form off individual Jupiter notebooks in the course material. Hence, Jupiter notebook is recommended. It's not compulsory. Although the Jupiter notebook is recommended, however, you are free to use whichever development environment you prefer to walk with. Many experienced and even relatively new part on users use pi charm, sublime text nor pad plus plus eclipse and so on. So choose anything you prefer and walk for you guys. I want to mention here that you can also known Lord all the nodes as dot P by filed, which is part on extension. These files are compatible with Pythons I DS or text editor, So I want you guys to go to the download course material link and download a copy on your computer. It includes Jupiter notebooks. Did our files T cheats and some reading materials, So the folder contains everything you need for this course moving forward. Let's talk about the installation or set of process. We will work with the stable version of Fightin Tree through Anaconda Distribution. It is recommended, however, all the North's and Syntex are compatible with heightened to aspirin, and the corner distribution is recommended because it's a piece of cake to get the python on your system through this distribution, even see this thing in a while. Another thing I won't wrench in here if you have experience in by Ponte and have already installed bite on on your machine. Instead, off in a corner, you may want to install the Jupiter notebook while pythons package manager Pip. If so, go to the come on prompt R C M D on windows or terminal for Mac or Lennix users and typing victory installed Jupiter, our Pip Install the Jupiter 50 or pip, depending upon what worsen of python you have. This is a quick and very easy install for you guys. So now for the new users, I strongly recommend toe install in a corner. One of the cool reason is you will conveniently install by item the Jupiter notebook and rage off other commonly used packages for scientific computing and data science along with this Anaconda installation. So let's move on and visit jupiter dot org. Toe walked through the installation steps. We are on jupiter dot org, which is the official That side for Jupiter. Notebook. Jupiter Notebook is an open source. That application that allows you to create and share documents that contain live court equations, realizations and narrative taxed uses include Did I Cleaning and Transformation? No medical simulation statistical. More telling did a realization machine learning and much more. This is the reason that Jupiter is a great tool for teaching data science and part on libraries. Another big reason. This is the industry preferred to, and many job descriptions today includes the skills for Jupiter notebook as well. So if you see on the Jupiter notebooks, that's I, you have first option. Try it in your browser I don't recommend this option for this course. You have another option Installed. The notebook. If you click here, it will take you to the installation instructions. You see that you have an option in solving Jupiter Northbrook using Anaconda. It is also mentioned on this website that we strongly recommend installing by towns and Jupiter Notebook using the ANA Corner distribution, which includes Fight on the Jupiter notebook and other commonly used packages for scientific computing and data size. So the first step is download Anaconda, and the 2nd 1 is installed diversion off Anaconda, which you download it following the instructions on the downloaded page and then Congress Relations. You have installed your Jupiter notable. This is so simple. Installation a few Jupiter Notebook and python using Anaconda distribution. You just need to download Anaconda and need to follow the on screen instructions to get everything done on your sister. Here we are on anaconda dot com on this website. If you go to the products and anaconda distribution, it will lead you to the software that we need to install. You have an option to install Windows Mac on Lennox. If you don't know this latest war gin part and 3.7. It only includes fight on 3.7 in it. However, we want to walk with Python 3.6. We need to get the previous washer there. We can have an option for bite and 3.7 and all other previous part abortions. Now you have two options to install the previous versions from their upside. Go to the Google and write down Older Worsens off Anaconda. The first link will take you to the archives, where you can get all the older Washington's you can see Anaconda to to and here and a corner three for linage. For Makro assets and for Windows, I suggest you guys to install 2019 disease or salmon or 2019 03 for Anaconda Tree. Both of these versions have optioned to create an environment, invite Auntie 0.73 point 63.5, and even in Pike on 2.7. I do have Anaconda Tree totals in 1903 installed on my Mac operating system. I commend you guys to don't load looters and Time team 03 version for your machine, whether it's Mac operating system windows are Lennox. I have Mac OS X, so I condone. Load this one here. Once it is downloaded, you can install and follow the on screen instructions. Let me tell you another way to find the older versions off Anaconda distribution from their rap side. You can go to the documentation, read more click here, and it will take you to the anaconda distribution on your left. You have user guide in the user guide. If you click frequently asked questions, it would take you to the questions. Now, if you stroll down, you can see here Anaconda installer archives. If you click Anaconda installer archives, it will take you to the same link that we have found Taguba. Google is always convenient in this way, because sometimes they change the layout off their rap side, and it is not easy to find frequently asked questions from the website. So Google is always helpful. So once again, as I have recommended you to download Anaconda 3 2019.3 for your machine and install this on the system, let's finish this installation and I will see you in the next lecture, where I'm going to tell you how to create the environment for this course. See you in the next lecture. Good luck 5. S:1 Setup Jupyter and Environment 2: Welcome back to the installation lecture. I'm going to tell you how to create a separate and standalone environment for any project it. And here we're going to create an environment for our cools, in which we will install the required libraries. And after creating an environment, you don't need to think about any other installation to all this course on your machine. Mac, the Knicks are Windows Run anaconda Navigate. Now you can see the screen like this go to create and then type the name off your environment. Let me type did a size and I want to create fight and 3.6 so I can say 36 Check this python and select 3.6. No trust clear. You can see this Lubar moving, which is telling you that it's creating an environment. So we are creating a new environment. Data Science 36 for our Cokes. It may take some time, depending upon your mission, so it is created. Now let's go to home and make sure we are indeed a science 36 The environment that we have created. Let's install Jupiter notebook fast, so press install and you will install the Jupiter notebook Inside your newly created environment, it Mitic sometimes, so wait until it is finished. No, we had done. We have installed the Jupiter notebook inside our newly created data size underscore 36 in one. Let's go back to environment and click this arrow and press open terminal. It will open a new terminal or command prompt on your sister. This data signs underscored T six is telling you you're going to walk inside this in life. We have already installed the Jupiter notebook Inside this environment, let's type Jupiter load book. And around this, sir, a new window will pop up in your default browser. I have the course material folder on my desktop. Let's go to the desktop and here I have to course mediated. For now, you can see these subdirectories that we're going to learn during this course. All of these subdirectories include the Jupiter notebooks, the court files and all other leading material Go to new click item three. And here you have the Jupiter. This first cell is a cord cell, and let's try to walk within this Sunday. This Jupiter notebook is actually a python gonna running on your local machine as We're going to create a new environment. What? I suggest you typing exclamation mark install Hand us equal equal 0.20 0.0. People in strong Mac plot live equal equal to point C 0.2. Once again, the exclamation mark keep install, Seaborn Equals equals 0.7 point one and pick in stall. We need a lot Lee equal equal to find 4.1. Then we need cock fling People in stall cufflinks equal equal. We need zero point 12.1 version. So let's copy this one here and based to see if some time. So we also need psychic long for the schools and we need little 0.2 0.20 point zero version for psych it last. We also need an antique A for natural language processing, and we need 3.2 point three version for this thing. We also need numb pie, but I'm not going to install a specific version off some pie for this course. Cannas and t bone are actually dependent upon numb pie. So if we install these libraries, we will automatically installed in Mumbai as well. So let's around this cell and it will take some time and you can see your installing all the required libraries on your machine. It will take some time because we are installing 123456 and seven libraries here, and you can notice here successfully installed numb pie 1.18 point one kind of 0.20 And if you scroll down, you can see the problems here successfully installed. These are the dependent library that we need for See Bone, and they're automatically installing all the dependencies as well. So it may take some time so you can see there's no more star. We have installed all the libraries and their specific version on our machine inside the environment that we have created, although we're not going to work with stats, models and pie dot But it might be good idea and solve these libraries as well. Find out is very useful in case we want to print the tree in our decision tree learning lecture off the machine learning section. So exclamation marks getting stall starch models and exclamation mark people install pie. It thought we don't need to tell which version we want to install for stats, models and pie dot it will automatically big religious Washington So let's run this cell here and you can see it is installing these to libraries. Shoe. It may take some time again, and it started converting to So we have successfully installed. There's no error. We have successfully installed stats mortal and pie dot so pied out 1.4 point one version is installed. It might be a good idea to check diversions that we have installed in our environment. So what we can do? We can import all these libraries in port number pi import and US import Met plot Live board See Bond import. Ah, steps models. We have import bluntly import Coughlin's in Port SK Long, which is the psych it law. And we have also installed pie dot import pie dot and, uh and l Tiki. So 123456789 10. 12 3456789 And detent one is number. So let's import them. And oh, you can see this warning here. This is just awarding here, which is telling you some information related to I python four point deal so it is saying you have to install I p y digits. So let's install Pip install I p Why Digits? W my e So this is I p. Why? If we install this thing So this is I p. Why so best on this again? Okay, so it is installing these i p. Why region so it didn't stall. Now, if we read on this these imports, we don't see any more. So let's check the versions of thes libraries that we have installed. It's very easy to check diversion off the Slattery's so we can use print. And the 1st 1 is nets. Copy this one and this detail instead of import print Lump, I No, I thought underscore. Underscore abortion. Underscore, underscore and print hand US panda start underscore. Underscore wasn't underscore underscore. And this same with print cranked on. Let's copy this sprint and see it sometime, Mr. Till So no, that plot leap met birtley taught underscored in the school version. Yeah. See, born dawn under schools under school version in the school. I think this is the way to get the This is the original. Which version you're walking with in your environment on in your machine are in your environment or on your machine. So snatch models don't worship. Underscore. Underscore Another trick I can tell you if you type pl and press tab, it will automatically fill the rest of Tibor here. And once again, the same stuff underscore in the school washing. So for cufflinks, the same thing his term Washington on the same thing for site psych it long and other libraries So P Why press tab? Don't don't if you if you type v and pressed have again it was out ofit for you and Ben and tiki dot Washington. So let's run this cell. And here we have we have numb pie 1.8 point one, pandas 10.20 and all the required versions in our in other environment and the environment name is did a size underscore 36 We can also check the version for pipe on Astra And so for back Look for that purpose we can say from we can say from platform import pile it on under school washing and run this son and then we can type in print or abortion this and find time washing the parentis is after this So let's run this, son. So here we have. We are going to work with Fight and 3.6 point 10 and all these libraries during this course . So once again, let's go back and over you what we did way. We started the Jupiter notebook and installed all these libraries with the required versions, not this exclamation mark. It tells the Jupiter notebook that we want to install this library, which is panels met, not lips, Yvonne or other libraries using people come up. You don't need to go to the command line to install these life is, although you can go to command line and install these libraries. Aspirin. We installed two more libraries. We don't need them, but it's good to have them. And then we imported these libraries with their names. We're going to learn all these things hold to import and how to create a leers and everything. Just take it as is at this stage, and then we check diversion for all these libraries. So we're good to go. We have We have all the required libraries installed in our machine, and, uh, no, we don't need to install anything more than these libraries during this course during this course. If you see I'm suggesting and asking you to install any libraries, you don't need to worry about that thing. That is just in case if someone has not installed any libraries. So we're done with this environment, I hope. I hope you will find this very easy and convenient to create your environment and seeing the next lecture where we're going to do, These'll decides. One thing I want to mention here, creating an environment is sometime not trivia. This is not really a part of data size, and I don't have any control on creating environment in your machine. If you find any difficulty or any problem you can, you can ask me right in the comments, and I can try my best to figure it out. However, the easiest way to do is Google your question, and you will find lots of tricks and tricks to figure it out. One more thing. I want to tell you a bold be Jupiter notebook. Let's go to the command line or terminal and type in Jupiter notebook before typing the Jupiter notebook are running the Egyptian notebook. It's good idea to see in this directly we are in. If I look at my computer and typing PWD on the command line or terminal and then this Come on, you can see that I am in the course material folder, which is on desktop on my machine. I recommend you guys to put the course material folder on your desktop and move into that course material folder. It is important to know that when you're on the Jupiter note for command on your CMD or command prompt our terminal window, the new trumpeter notebook will open in your browser, and it will start from the same folder you are currently in. So it will start within your working directory. We can use CD and before the name to move into the required folder. So if I type in Jupiter nor awful and run this cell here, you can click any foreigner and then you can see all the files within that folder like trees here. And these are the Jupiter notebook exercise files and data files in my folder. If you press s me, um, you have all the file which comes within the course material folder. So once the notebook is open in your browser. Go to this new and you will see a couple of options press despite and three. And a new notebook will open in the new tab in your browser. Now you have the according sell here. Let's try to print something here like print and hello, Ward and then drunk. This set. You have options here. Like Johnson, this is interrupted Kona. This is Restart the Kona. Let's stick with this round cell at the moment and press this run. Sell butter So you're Jupiter North. Book is walking. You got this output when you run the court in this court before we move on, I want to mention couple of other things for your convenience. Rather than pressing this run sell button again and again, you have a shortcut shift plus enter to run this court cell like once again, print hires and if we press shift and enter, it will run the cord in this cell. So instead of pressing this button again and again, you can simply press shift plus enter and you can run this scored in this court set. If you go to this option here and click on this core you see, you have another option marked on if I press marked down so this print high is converted into mark don't sell. Marked on cell is very useful for notes or comments, So this is not the courts cell anymore. If you run this court, it's not going to print anything because this is not the courts. This is very common mistake for the new users. Many times they just get confused. That why this court is not running a very quick hint is, if you don't have to call it highlighted. You're not in the court, sir. If you convert this Trent high from marked onto Court Self, you will see that this print is in green and this is strength, so the cord is highlighted. And now if you press shift, enter this cell will print the out foot. Another thing you may want to know. If you go to this, help that and see you have keyboard shortcuts. You have couple of shortcuts here. You can go through these shortcuts and see if you prefer to use any of thes chocolates while working with Egypt. Another very important thing I want to mention here you have a colonel option. If you go to Colonel, you see? Interrupt these. Start the started clear output and couple of other options. So in case you get stuck in the situation where something is running for our say an open while loop, this is the case. When you want to use the Colonel Pap, this is going to be greatly helpful. So go to the Colonel Tab and press this restart and then the start here. What this will do This will kill the process and restart Bikaner. Actually, your trip it and Lord book is connected to a colonel which is simply an instance off python running in case something is wrong. Such as Piketon is crashing. Are you wrote a script which is infinite loop or taking a long time? You can simply go to this colonel option and we start this carnal and then you're out from that problem. Another thing you may want to know if you go to file and you see download as you have a couple of options notebook dot i p why? And be dot p y html MD and lots of other options. So you condone load this pipe and notebook in all these form. It's so I believe this is quite sufficient for you guys about Python notebook at this stage just to remind you. Shift plus enter. If you want to run the cell. And another thing, the Jupiter notebook will start in the fuller where you are in the terminal or CMD. If you want to change your working directory, you can change it fast. Another quick reminder here question and answer forum is greatly helpful. If you have any difficulty installation, please post your question in Christian and Answer Forum, and I would be pleased to help you out. Remember, Google Search is very helpful for most of your questions as well, because you are in a very big community now. Last point. I want to mention here I've been time a bust to keep the recording pace within an average change with pauses accordingly. It is very important so that everyone can follow the instructions in the election. However, if you want, you can control the recording speed during lecture. According to your requirement, you can also control the volume according to your requirements and environment around you, so I am sure you're very excited now. sharing the next lecture where we're going to start the real walk. Good luck. So at this stage, I hope you are ready to move on to the real work in the next lecture. I just want to remind you, if you have a question, the very first thing you should do check in F Accused Section to find the answer. If you don't find your answer in F A Q section, go ahead and search, question and answer for used the most appropriate Kiev or during your search. If you still don't find the answer to a question ticket Elite and post a new question to question an answer for please explain the context while posting a new question. This will make everyone understand what you're asking. Once your question is there. I'm always ready to help you guys in your problem. So see you in the next lecture, where we're going to start the real walk. Good luck 6. Download Course_Material: 7. Env File: 8. EnvSetupOtherOptions: 9. Important Note!: 10. Re: Possible updates : 11. S2: Python data types Part 1: Hi guys. Welcome to the Party and essentials Lecture, part war. A quick note for you guys. If you already have a good knowledge of fight on and or working experience in any other language, you can skip this lecture or even the full section. However, a quick review is recommended to brush up the basics. In this lecture, we are going to discuss the key concepts off fighter. We need them throughout. In this course, this section is carefully designed for all levels, and if you do not have any programming experience in bite on, it is still very easy to follow. For those who wants to explore Mawr in further details, following re sources are very useful. Bite on dot org Learning by turns, documentation and learning by turn gift addition by Mark This book is a great resource for bigness. We will go through the falling contact in this section we've been talk about by turns, data, types, numbers, strings and print for mating lists. Dictionaries do bulls set and billions. Let's start with creating a new notebook here. File New notebook bite and three. Let's discuss numbers. Forced fighting has two basic numbers. Tie in. Teacher and floor. For example, Tools is an in teacher, whereas 2.0 is flawed. We can perform a little Matic operations to either of these numbers, like why Plus two, which is salmon Y minus two is three like we can multiply them using ecstatic signed between them. We can divide them with the forward slash between them. Why divided by two, Which is float 0.2 point five so we can get the power of five using to hysteric between them. So it means five. It is to power tube. It should be 25. Another important thing to understand by then follows the order off it Matic operations. For example, if we have one plus to multiply by three plus four, what frightened US fight and first multiplies thes two and then perform other operations so it will result in a lemon in the output. However, a good practice is to use parentheses to tell the bite on which operation needs to be performed and clarify the order. The operations in the parentis is will be performed forced like, let's call for this one this detail and put one plus two in parentheses. NT Bless Fort in parentheses. So now two plus fun and three plus four will be performed first, and then they will be multiplied. The answer will be 21 which is different from the previous equation. Modelers or more Operation is a percentage sign in by Tom. It returns what remains after a division with more operation. We can check whether the number is even a horde like if we have six March 2. If it returns zero, it means the number six is even. And if we're five more tubes and it returns one, this means this five is are so moving forward. Let's start herbal variables Now. At many occasions we pick a Vidia ble with some name and a sign object or a data type toe that valuable. We can do this in Pitre using Equal Sign Operator, which is simply equal sign. For example, if we assign value 52 X and see why equal to three now we have X equal to five, and what equal to three if it print? Exe on Lee. We have five, and why only we have three. So, accent, why are the variables with values five and three. We can perform a Little Matic operations using these variables. Life, we can add, these variables we can. We can subtract them. We can do multiplication within do multiplication, and we can also do division aspirin. We can perform in a mathematical operation and assign the result to a new variable as well . Like if we want to assign X multiply by why to a new variable says that here and then said Equal to 15 which is the multiplication off acts and why so moving forward, we can be assigned the value of valuable like we can. We can say x equal to X. Multiply by Thanks, but keep it in your mind. The axe will lose its original value off. Five. Now reassigning will give a new Value Toe Act, which will be acts in tow acts. Let's check the thing. Let's spring X now, so no acts equal to 25 instead off five. Another very common example is to use variable with multiple names, like somewhere using post for May equal to Jeff, we can sit total loss equal to 20 and similar variables, so invite on the proper syntax is to separate them with under school, and this is underscore here. By doing this, you will easily identify them. For example, if you know total loss If you know first name, you can simply easily identify them. This is the first time this is the total loss. So a couple of important things to remember while creating the video will names in bite on variable leave cannot be started with number Like If I want a valuable one Some variable war equal to two. This is going to read an hour. I can't use variable with some special collector like Star War equal to two. This is again going to raise an error. Another important thing. His name is not equal to name. So if I say name equal to chair and try to print this with capital name This is not saying so. Variable names are case sensitive. Me with a capital M is not equal to name it small. Another thing to remember These awards cannot be used for variable lane like class is there is a word I can't say classy could too Yes, I can say K l A double s equal to two, which is not. It is award, but I can't heal seat a glass. So let's move on to the next little type strings, which is one of the most popular and useful Did I've been biter. They can be created by enclosing characters in single or double courts and bite and consider single and double courts in the same way. Strings are very useful to record tax information as well as arbitrary collection of bites , such as contents off any image. Let's create a simple string with single courts creating thing if it single courts. Let's create the same string with double course and put it in double cords and say, This is trouble here. So Brighton is taking single and double court in the same way. If we have lots of other courts in our string, we can wrap them in the double course, like That's right. Another example. We we have lots. Oh, but the courts in that trapped I mean double took. This is what we have lots of courts in double coated string, so we can pass a string to a video bill as well, like X equal to it's drink. And if you print acts, this is all print is demented, like if we want to get out. Put X in fight and we actually, the proper way is to use print. This is the proper way to get out. Put in pi time. At this point, let me introduce a very useful building method for Mitt with the use example. Let's create two variables last year we have a name. Jeff. Put them in a single course. Just make string ich equal to 30. What we can do we can use like we can kill you to string. My name is that's what curly bracket I'll tell you why we're putting these curly brackets here. My name is and my age is just put another set of curly brackets and call admitted for Mitt passing the arguments name ich what we hear. We have a string in print statement with to set of curly brackets which are actually the placeholders and we're calling dot form. It mattered here to put the values off name and age at thes two placeholders. So this statement, using form it, we are putting name and age in order. So these two placeholder what we have created using curly brackets in our string. Let's train this one. So my name is Jeff. This place holder is taking me Jeff, and the second place holder is taking age 30. So there's another very useful way to write the values in the placeholders. In this case, we do not need to worry about the order in the former matter. Let's try that one. Let's copy this statement and paste it here. And let's say this one is one equal to me and to equal to age. And this. Let's boss this one to the first place holder and two to the second place holder. Now we have first place water. One second place holder two and one is actually named to his age. So we get the output. My name is Jeff, and my age is 30. What if we change these in this case? What if we change these this order? So we're getting the same output. So in this case, we don't need to worry about the order. Now we can put more than one placeholders for the same values. See? Let's see. Print. Let's copy this again and see once again to to let's see. So what we have My name is Jeff and my age is 30. Jeff again. 30 30. This is going to take argument to this is 12 again to Okay, So in this way we can put more than one place holder and we can reuse these values simply by calling with their variables to and one hit. So moving forward little more about ST history is a sequence a position we ordered collection off other objects or elements. Strings maintain, elect right order among the contained items I turned the stored and flashed by their relative position. Like if we have string acts S t r i N g. These letters do have their own position. Strings are immutable. In bita, they cannot be changed in place after they're created. And in simple words, immutable objects can never be overheating. For example, we cannot change a string by assigning toe one off its positions. But we can always build a new one and assign it to the same name. So let's create a stringer. We can simply use this one, actually, and we want to grab the first letter s every set. String is a sequence we can grab any off its letter using its index. Say we can grab the 1st 1 and what we need to do. X index in strings starts from zero X is you. This is the first letter in our strength. We can grab the last one using from the back minus one. We can get a slice. See Knicks four. So everything from see you up to four. We don't need to say zero here, like this is same as 0 to 4. I hope that you already got a good understanding of strings. This is a good point to introduce some commonly used methods such as lower up split and so on. Let's see how these methods work with string. Let's create a simple string s equal to high. I am Chief. I can call s dot lower Benten method and this will transfer all off the letters in the stream toe the lower case. That's a couple of cells here I can call s dot apart and what I should expect everything in uppercase split is a very useful matter that we use quite often with strings split returns , a list of words in the string using separator perimeter as the D limiter string. If Sepp or separator is not specified, any white space in this string is considered as a separator, and empty strings are removed from the reserves. Let's split. The string s using a start straight. We don't need to pass anything here because we want to split at white space. So we get the list off all the words in our string. Hi, I am Jeff. Split is very useful in different faces. Like someone tweeted, tweet, ease Cool claims boom and flames is a hockey team in Calgary. If you want to split this tweet, say at hash what we can to weekend treat not split and passing Fash So what we're getting Go flame go and hockey two elements in a list and what you want to know which game it is so we can policy position one and it's only hockey. So this was all about strings, guys, I hope you got a very good understanding of strings and some useful matters that we can use . And we will be using indeed scores at the later stage. So this is getting long. I will split this lecture here and see you in the next lecture with the other data types 12. S2: Python data types Part 2: So welcome back, guys. As discussed in the previous lecture, spring is a sequence of items. Let's move on to this idea to another very important and useful data type in biter, which is list before we move on. Some key points for lists are lists. Are positional ordered collections off or bitterly typed objects it can take any? Did it I list is a sequence off elements separated by commas in a set off square brackets like we had. This has started split with the items high. I am Jeff within the list. Lists have no fixed size. They are immutable. Unlike strange lists can be modified. We can add new item in the list. We can remove any item and these operations we can't do with strings so list can be indexed and sliced like strange. Let's create a simple list here that's passing some kind of See how the list looked like for two 34 So this is our list we can give a B C to list. These are strings about ABC is out of place. Let's create a simple is my list and passing ABC. So you know I have my list with a B and C strings my list. This is my list. So we said we can index a list. My please CEO, which is the first element B is the second element. One c is deterred element to what If we want to add something to my list, we can use append Say we want to upend de Let's see how the my list look like. Now we have a B, and this day is appended with list. Now the D is appended with my list. Pop is another matter which removes and return the last item from the list. Say my list, Doc. Oh, so deep. Is it the last item we're getting in the output? Let's see how the mildest look like. Now we are back to our original list. So the pop has removed the last item from the list. Another very important contract. We can nest a list within a list and grab any element in the nested list. A very useful feature which is applied in this case is the mattresses are multi dimensional areas. Let's say if we have released nest, we want 23 and we have another list within list. Poor right. Sick nest. Looks like 123 And this We can grab this whole list. Mast index three, Which is that? Index three. So know what? If I want five, we can further index on this last year. Like this nest three. We have this list. And then didn't that zero and one? No, we got five here week in Boston. Like messed instead of 456 Or instead of anything like, let's copy this one here and bus in. Mm. Be. So now the nest is now the nest is 123456 at place three. And then maybe a list of strings at place. 101234 So far, we have learned about strings and lists. They're somehow related to each other as they are, just sequences off items, and we can use same index notation to grab an element so we can index them. On the other hand, dictionary there's something completely different as they're not sequenced at all. Dictionaries are actually key value pairs in college records. The store objects by key instead of by a relative position, and they don't maintain any reliable left right order. They're simply map they simply map key to the associative value, like if you want a value, we pass in the key, and we get that value. Old dictionaries can grow and shrink on demand like lists. Next, create a scene prediction led one. Which is, we said in curly brackets with key value pair. Let's say K is key one. We person the Value River we have G. We have kids, too, as a key, and V two has a value we have. Game three is a key Henry three in the radio. No, we have D one. So now we have the one. As a dictionary, we can assess any value in the dictionary using its key like in list and String index, such as the 10 is not going to walk because he's a key value pairs if we see people, yes, this is going to war. So we're passing key and we're getting value out. Begin to to We will keep the value, too, so dictionaries can take any item as their value. For example, we can have a list with associate ID key in the dictionary. Let's create another dictionary D to and passing You won and Let's see. 123 is the least rare. And our kids to even a little east? No. Yeah. And be what if we want two or what? If you want a this, we can pass him the key. And this is what we have. 123 And now we can simply index want to. So, too, is that index 01 So here it is. What If you want to grab be here, It's again simple d to oh, Keys kid too. And then we're indexing over this list here, too. Index. Sheetal here. So we got a We have a dictionary. Hair. Do you want? What if we want a list off keys or only or a list of values only we can use building method dot keys. And this will return all the keys within the dictionary D one as a list. I can get the videos aspirin using method values. So this will return me all the values. We want me to be three associate with these keys with addiction. So this was brief introduction on dictionary guys. Let's move on to another very important data types to polls. Two polls are similar to the list but cannot be changed to pull our sequences like least. But there immutable like strings so immutable you can change them to pull. Used to represent fixed collections off items in your cord, like in your court. If you don't want any change for certain items, you can just pass them to a Triple Two polls recorded in parentheses instead of square brackets. Let's create a very simple to polar T equal to 123 We could index t zero is formed. T still is three. Let's try to replace one to some new values. Let's say so. T zero is one this boss into new. It's not walking because to pull our immutable, we can pass in any new early. We can't change the value in tow. Let's move on to set snow. Such is a collection off unique elements in a pair off curly brackets like we have 123 What if we have 1 to 2, two and three? We're not getting 23 times what we said in the Dignan unique elements, so an item appears only once in a set, no matter how many times it is added. If we even add three times four times. Like if we add 1 to 2 333 that's a couple of times. Still, it really only appears one, even if it is in the sector, like seven times we can use admitted where new element to set Leslie the set force as equal toe 123 s store this dot Let's aired for here. Bring us best equal toe. 1234 This four is a day if we want to add four again yes dot and you think it's going to work and bring us so it's not going to walk because, said, Can Onley have unique items, it can have four only ones. We can add multiple time, but they set. This will appear only once in December, so if we want to add for again, it will not given error. But the output will be same. As said. Can Onley have unique elements? So moving forward? Let's talk about the last data type Boolean bullion, the simply true and falls with a capital T and kept a laugh, which is just a customised version of zero and one like something is true, it is true. Something is false it is false. Let's recall our my list. We have my list A, B and C. We can check if there's any element within the list like we can see. And my bliss true. One in by this. It didn't get item of one in my list. So it's returning falls. Is it any Tzeitel? No, there's no zero in my list. So this was all over a 1,000,000,000. Good job, guys. So as a quick review what we did so far, we have gone through the basic bite on data type. We have learned these data types with examples. Let's move on to the next lecture. Well, we will overview the other important conception by time. See you in the next lecture. Good luck. 13. S2: Comparisons Operators, if, else, elif statement: Hi guys. Welcome to the Parton Essentials part to lecture in Depart one. We have explored Buyten's data types. Now, in this lecture, we will discuss combat Isn't operators if else and if statements, Let's more want and learn by drink. You can either create a new Jupiter notebook or you can continue with the previous one. So let's continue with the previous one. Let's start with companies and operators. Comparison operators allows to compare two elements to each other, such as greater than lest in equal to not equal to it's spectra. Something like we have three is greater than four. This is false. So we're comparing if three is curdled and for and we're getting in the output. This is false, So you three is less than four. This is true. What if we want to say greater or equal to is greater or equal to four? This is false, and the same way like door is less are equal to four. This is true. So if you want to compare two elements like one, it seems as one or one equal to one. This is different than Equal Sign, which is also called assignment operator. So here we're comparing. If one is equal to one, this is true. If one equal to two this is falls. We can compare toe strings like dim and do you? They're different. So it's false again. Another type of operators of logic operators, logical predators, combined multiple conditions using keyboards like and or between the conditions. In case off end, all conditions must be satisfied. Like if you want to say one is less than two and to is less than let's put them into apprentices. So if we're on this thing, so one is less than two is true and two is less than three is true. So both conditions must be satisfied. For our operator, one condition must be satisfied like like one is less than two four to its secular than three. Let's put them in apprentices again and run this statement. So this is true. So one is less than two is true. However, to is greater than three his falls. But because this is our operator, one condition must be satisfied. So this one is satisfied and we got true in the output. What if we have one is skittled in two oh are to escape It'll then? Three. This is false. One is good than to. Is falls to is greater than three is false. So both are falls, but still with our operator. Because minimum condition is one must be satisfied so that output is false. Let's try another 11 to oh, are to equal to three. Oh, are four equal to full in this condition, one is equal to two is false to equal to three. His false four equal to four is true. What should we expect in the output? Let's try. So this is true because this four equal to four satisfied and we met the condition, which is one condition must be satisfied for our Sure this is true, so moving forward to if else else. If statement lots of times we want to execute the court to perform some action based on like if the condition is true, we want something in the output. If the condition is false, we don't want to run the block off court. After that, we can do such things using if else hell, if statements The Parton. If statement select actions to perform, let's try with some example. Let's see, let's add some cells first. So if three is greater than to and we have it calling here, Enter screamed True, Let's run this thing. This is true. If three is greater than two. Yes, three is greater than two condition is satisfied and the next chord will be executed. Not is the block off white space before the print statement. It is very important in part time. Beytin does not use brackets in order to separate a block off gold execution statements. It uses white spaces instead, like most of the other ideas for bite on Jupiter automatically does this condition for us after a caller. So we have a calling here. Jupiter No took knows what he has to do. So it gives it space here for the next block off court. So what if the condition is not satisfied that strike, if three is less than two caller print. True, we don't get anything in the output. So in this case, condition is not satisfied and the cord after this condition is not executed in such situation. We usually want our program to do something even if the condition is not satisfied, like we want to print falls. If the condition is not satisfied. At least we want to know that our court is forking. At least we want to know what the cord is dying. This is very introduced else. Let's try this thing again. With else, give three is less than two pranked True felt's brink fault. Now we have falls in the outward. So if condition is not satisfied, the next statement is not going to be executed. The control will be shifted to the L statement here and it will print falls because the condition is not satisfied, we can have multiple conditions in the court. Let's introduce L if in such situation, and if is a shot off else. If we can introduce many LF statements in the court like we can have if one equal to two brings statement one, we can see well if don't equal two to friend Statement to and let's finish it did else else print statement. Three. That's not discord here, so we got a statement to in the output. What is happening? If one is not equal to two, which is fault, the control will be shifted toe l if statement and it will value it if to equal to two and then print statement to not is that the court would only execute the first true condition. It doesn't matter if you have other true conditions in the court after first. True, this is important to know in l. A. If statement that the court will only execute the first true condition and it will leave the bloc after that one. Let's try another one here if one equal to two. Let's copy this cold here. This is much easier to copy and we can confirm Ford this ELT to well, if and then add cells spring statement for imported inlay course and we can see three equal to three. Let's run the score. So now, once again, we have statement to in the outward, even the three equal to three is true, so the cord will Onley execute the first true condition. Although this statement is true, the statement will not be printed as the second is already true and is already executed. So this was all about combat isn't operators if else an if statement, I hope that you enjoyed this lecture. Let's move on to the next lecture where we will overview the other important concepts in part on, such as loops, least comprehension functions and much more sealing the next lecture, Good luck. 14. S2: Loops, List Comprehension, Functions, Lambda Expression, Map and Filter (Part 1): Hi, guys. Welcome to the Parton Essentials Party lecture. In this lecture, we will go through the falling very important concept loops, range list, comprehension functions and Lambda expressions, map and filters. Let's started creating a new North Book are we can continue with the previous one what we already have. So let's continue with the previous one. We will start with while and far loops while and far loops are the two men loops in bita in loops. The statement. Performance action over and over, based on the set condition. Divide loop continously perform an action until some condition has been met. Bite on. Keeps evaluating the test expression before executing the statement, which are a nested in the body off the loop until the test returns a false value. That's right. A very simple while. Lou. We'll start with initializing an intelligent I equal toe one. Why tell the condition? I is less than five. Print something. Say the value off. Ah, he we can add placeholders here and use for merit passing the I and that's true. Another thing here Inclement devalue ALS I equal toe I plus one. So what we're trying to do while I is less than five. Print the value off I and after printing and 12 I not sure on this thing. So we have value 1234 in the outward. So the Prince statement will be executed until the condition is until I is less than five. When I is less than five, whenever the condition is false, we are not in the loop and it's not printing anything in the output. Let's try something here. So what if we don't want to add equal to my plus one? Let's run this statement again. We are somebody in a never ending loop. Look at this one. It's printing, printing, printing with weaken scrolled on, and it's kind of never ending value. So now we're in the infinite while loop. Because I is always less than five, I is always one here. If you get into the infinite wild Oh, you will notice a continous output or a static on the left side off your son. It will appear for a long time, and now you have to these start the carnal or let's interrupt Colonel here every nice and elegant way off exiting the while Loop is using else statement, Let's add and at this statement tells sprained exit Now, what will happen once the condition is false, the control will be shifted to else and it will print exit means we're exiting the blue. Let's run this court here. Yes, here it is. So after value for the control is shifted toe else and we get exit in the output. So this was all about while loop at the moment, let's move on to the far Lou. Far loop allows us to retreat through a sequence. The four statement works on strings list to pull and other building Atria Bols as well as user defined objects. Let's get a list My list here with some numbers say, 1234 and five. In a very simple far look, we can execute some block off court using the loo for every single item in my list. Let's try this thing far. I Tim skin my list print. I m So what this court is doing the court is taking, and I don't one by one from this list. And printing that item in the output until there is something in the list item is a temporary Vidia bill here and it can be whatever you want. It can be. I sit I and then it will be I hit. It can be a axe name, numb and anything, but a good practice is to use it carefully so that you can remember. And whenever you come back to check the court, you can understand what you have written. A good selection in this case is numb because we have numbers in our list. So another very useful trick is always use comments in your court. This is a great way to remember and also helpful while working in a team. Let's try another for far numb in my list. Sprained. Hi. So what's going on? LOL, you notice that the block off court print high doesn't need to be related to the items in the sequence. In this case, my list. We can print anything we want. Let's try another example far numb in my list. A friend. I see it numbs square. So now we're getting the scare off the numbers in my list. One to scare 43 is nine for four. It's 16 and five is 25. This was all about the loops At the moment, we have explored while and far loops. After discussing loops, I want to introduce a very useful loop related function range at this point, rather than creating a sequence, especially in the far Luke, we can use range method, which is a generator off numerical values with only one argument. Range generates a list of integers from zero up to, but not including the arguments value with two arguments. The first is taken as the lower bone as a stock point and the last is taken as the upper bone. We can pass in three arguments to range as well. The third argument is a step which is optional if the third argument is provided. Beytin ad this steptoe each successive in teachers in the result. And if we don't pass third argument, the default value off step is plus one. Let's see range. We can press in shift tab and we can read the document strength for range. Let's try range five passing on Lee. One argument in this case we have 0 to 5. We can passed in range to enlist, and we will have the list off these values and then we will have a list of thes number 0123 and four. Let's try arrange with four Look for I in SE Range five. Print. Hi, Let's Execute Discourse. So now. So now I is actually treating over. Let's try arranging to arguments in a Farlow. Are I in range? De and five. Print I. So, in all we have the start point and the endpoint start 0.0.3 and 45 is not included. The upper bone. It means less than five. The upper bone is five. So until it's less than five to strive for Luke with Strange and at a step in it for I in range one dude, then with Step two brained Brink. All right, so now we have to as a step So one plus 23 plus 257 and nine. So this was about range. Let's move on to list comprehension. So do you remember the basic mathematics like we used to have something like this like exterior, whereas X belongs to end. This gives the scare off all the initial numbers. Like another example in sets. Ex clear X in 0 to 9. Give the square off the numbers within the provided set, which is zero and nine. This comprehension implements such well known mutations for sets. It is an elegant and concise way to define and create list in Pirata and off course. It saves typing as well. It's Syntex is statement, followed by the FARC laws. Within a square brackets, let's we have a list X equal to 234 and five. We want to create a new list that contains the squares off the elements in X. We can do this using a for loop like out equal to initializing an empty list for Lum in tax A pending oh dot a friend No, um, square And that sprint in the same block. So what we're doing, we're initializing an empty list running a far loop on x A pending the depending the scare off the number to this empty list out and then printing. And we have 49 16 25. Describes of thes numbers in X. This task can be elegantly implemented using a list comprehension in one line, Of course. Simply Dick Far statement and put it after what you want. In the result in the square brackets, that's right. At least comprehension for this loop. So numb scare for numb you X So we want this in the output. For what? For this backs for number in X. Let's run this thing. We have the same output as from the Farlow. So this is a very concise and temple cold for this complete block. Another example using string like Char's four chars in passing string. Hi, Jeff. So not divide space here. We have white space in our string and we get white space in the output. So we get a list off all the characters we get least off all the alphabet in the output. Let's use list comprehension with range Numb square for numb game range said 2 to 10 so we can use range in list comprehension. And we're getting here to scare off numbers for 9 16 upto anyone. So this was all about list comprehension. Looks like the lecture is getting longer. I'm going to split here and we will talk about the functions map and filter in the part two off this lecture, she and the next lecture. Good luck 15. S2: Loops, List Comprehension, Functions, Lambda Expression, Map and Filter (Part 2): Welcome back to the lecture to off Party. We're going to talk about functions now. You may have come across them before in other languages where they may have been called subroutines or procedures functions solved. Two primary development rules. They maximized the reusability after court and minimize redundancy. The second role is procedure decomposition by splitting systems into pieces that have well defined roles. Functions reduce our future war. And if the operation must be changed later, we only have to update one copy in the function. Not many scattered copies off the court threw out in our program in Python, the e f create a function object and assigns it to a name. Let's create a simple function. See the E f Time name plus in some part of me toe Prem one and print from one. And it's at another line of work brained cramp. One plus, this is by time. So let's run this cord Well. We can call this function funk name like fall name. Bossing some string. Hi and let's execute. Hi, this is Pirata. So what's going on? We're calling the function front name with an argument. High it passing toe prime one and then run the first line, which is high only when it comes to the second line. Here it prints Prem one, which is high than using. Plus, we're can, Captain Eating Prem one and the string. This is biter. So it's printing. Hi. This is by time so we can use default value of perimeters as well. Like let's define dysfunction again. We can copy this one and paste it here and instead off we can pass in default, lend you and now from the school. Now, if we call this function no, If we don't pass the perimeter to the function, it will consider default. Well, you as its perimeter. Let's run this court. We have default value, which is Prem one printed in the output from this statement and from the second print statement Default value. This is biter. If we pass it Param Eter here it will depress the default value like we can say hi. Now this default value is replaced by high. So it's printing high, taking this past for new and printing in the old port. That's creative function that takes two parameters and returns the multiplication off those two numbers we would like to function, say, defy death, my folk boss in someone in them, too, calling here num equal to We want to multiply someone in them too. And we want function. It was it on the multiplication, which is no less. Let's on this court And no, that's called the Function my funk passing two numbers two and three and on this court. So we have six in the output. So we're calling the function my funk, passing two arguments to for number one and three Phanom, too. It's multiplying and returning the result. Yes. No. Instead of writing these two lines, we can delayed this one and simply Don num one and come to this will be the same. So instead of writing to line called, we can simply return the multiplication of number one and number two in a single life so the functions can have documents things as well, and the documents drinks are enclosed within double courts. Let's take this function and at a document string here this function is the attorney multiplication off do numbers. Let's run this court now. What If you want to see this document string in Jupiter notebook, we can write my funk and press shift tab. And when we place shift up Jupiter notebook knows that the U there is asking for documents . String. So this is the document string that we have written here. So even commonly, you'll shift that matter to see the documents ring for the building functions within the by time. During this course, it's important to know the documents. Things are very useful, especially for building functions. For example, just try for range if you press shift up. This is the document string for range. So now, in this case, we don't need to memorize this all. We will be using this feature lots of time in the course at the later stage, this was all about the functions. Let's move on to the Lambda Expressions. The lender expression is a very to create small, anonymous function that is a function without in name. These are true of a functions and created when we need them. Lambda expressions are mainly used in combination off filter and map functions. Pitcher building methods in Python journal Syntex for Lambda Expression is Lambda a keyword and then argument lists followed by caller and then expression. The argument list consists off comma separated list off arguments that we passing. The expression is an a little bitty expression. Using these arguments, we can assign Lambda Expression to a variable to give it a name. Let's write a function which returns, scare off the number and then rewrite that function to Lambda Expression. So let's add couple off lines here. So that square numb very Tom no square that's run this scored and then all the function scare for we have 16 in the outward. We could like the same function in a single line like this and call it again. So it's drinks. Same job, not right. The lender expression for this functions, we have to follow the falling steps. That's corporate listing here and based it in the new set. The place duff it lambda that delete the name off the function, which is square. We moved these parentheses and then delete return. So this is easy. Now we have transform. Now we have transformed dysfunction into Alemdar expression. We have replaced death with Lambda, deleted the name off the function and removed thes parentis, ease and then removed Return. That's run this so we have something fun. Main Lambda. Hold on. We will use this expression in map and filter to understand in detail how the Lambda War That's loan map and filter now. So we have seen that we can calculate the squares off numbers in a list using a for loop. So to do this, we need to follow the falling steps. That's more one and see where we did this before, like here. Create an empty list it right over the list, acts here and then append the square off each number in acts to the empty list and then print devalue. And yet this is tedious process. This is where map plays its role. Let's try to do this above task again. Using a for loop, I have X equal to 1234 and five. I create an empty list. Why equal to empty list? I no. In the far Luke numb in X Coleman and then append devalue off numb scare to an empty list. Why? And print why? So I have one for 9 16 and 25 to scare off these numbers. Bidding X map is a function with two arguments. The function and a sequence, for example, list it maps a function toe every element in a sequence we have recently created a function square. Let's pass in square and acts to map and result equal to Map Square, Tex and run the score. Let's see hold the desert look like now. So we have to pass this reserve into at least to get oh foot. So 149 16 25 The same one what we're getting from this four loop. So using map, we have to. So using map with square and passing in the list off numbers, we're getting the same output. Linda works great with map, for example. We don't need to write this function square. This is one time use on Lee. It's better to use. Limped on for this purpose. Let's try to write the same court using Lambda expression. So we have a map. We pausing them? No, we can call me this one, actually, because this is our limbed expression for square. So our first expression and our second expression is X. So instead of passing square, were writing Lemper expression either. So instead of passing square, we're writing Lember expression here, and we're passing ex the second least second argument, and we need to wrap it into it list so that we can get output. This is the same one. So this whole function in a single lying where we don't need to create square using. We're using left expression for square and then passing in the axe, which is the list off those numbers that we want to help their squares. Far Matt can be applied to more than one lists as well. Let's say we have released E one to three four, the SE 17 12 11 but then and see C minus one minus four five, then nine. So let's copy this court here. And if you want to add these three lists, that's passing tax, why and set and what we want to do. X Plus Y, Plus said. And what are our lists? Our lists are A B and C, so we have X wise that from each list, and we want to add those x y and that and what are our lists? A, B and C. This is our Lambda expressions to add these lists at each index and ABC are our list. Let's bring this one so we have 17 10 1923 one plus 17 minus one is 17 two plus 12. Minus four is 10 three plus 11 plus five is 19 and so on. So this was all about map. At the moment, let's move on to the filter. Filter is an other very useful building function and provides an elegant and smarter way of filtering out the elements in the provided list for which filter returns. True Filter takes two arguments, a function or limped a expression, and at least this is same as map forced argument returns bullion value. True, our fault. The function, which is argument one, will be applied to every element after list, which is argument to if the function this is actually the argument one or the Lemper expression returns true for the element in list, which is our argument to the element will be included in the resulted list. For example, let's filter out even numbers from 0 to 10. We can use a range here aspirin. Let's write a Lemba expression force limped, uh, numb. Begin use more operator moored to equal to zero. This is our function and range. We want between one and then let's put this Lambda expression and the range argument in Filter. And then let's pass into the list so we can get out foot. Here it is. So this is our limped expression or function as an argument. One for filter Range 1 to 10 if the argument to for Filter, which is a generator for the numbers. If the Lambda expression is true for the number in range, it will include in the list to return. Zero for return 06 return zero and eight return zero and the filter is returning the numbers. Where? The Lambda Expressionist True. So this was all about filter guys. I hope now you have a better understanding on functions Lambda Expressions, filter and maps, along with other key concepts. We're done with bite and essential section. It's time to do some practice. In the next lecture, we will have a quick overview on the part on essential exercise. It's a good idea to try them out first. However, after that we will discuss the solutions as well. So see you in the next lecture. Good luck 16. S2: Python Essentials Exercises Overview: Hi, guys. Welcome to depart on essentials exercises. This notebook provides exercises to test your understanding off bite on basics. If you find these exercises challenging, then you may not have enough programming experience. You need to spend a little more time understand by towns basics before you continue to this course, I think, meant going back to the beytin essential sections and watched the videos again. All you can follow these links to read a little more on the bite on basics. So let's move on to the exercise over you. In these acts societies, you need to complete the task given below and answer the questions. If there's any instruction, follow those instructions like you have to answer what is five to the power of three and so on and move on to the and of this notebook. Not that if you write your gored in this so just before the output, you will lose the out foot because when you run your cold, you will lose this output and your output will be treated on this our existing output. So please right your court in the provided space were you find a white over writing the output please court here In this way, you will not lose the existing output. Try these exercises yourself before moving on to the solution section. See you in the next lecture where we will solve these tasks. Good luck. 17. S2: Python Essentials Exercises Solutions: Hi guys. Welcome to the bite on essentials Exercise solution lecture. I hope you have already completed these tasks. However, let's go through these tasks one by one in this lecture. So in the question one he's asking for what is five to the power off? Three. So you have to find five years to power. Three. We know we can used double hysteric to get the value. So five there's to power 31 25 in the next task he's asking for what is the remainder if nine is divided by two. So we know we can use Markkula separator to get the remainder. This is for in the next task can more destroying us, which is already given here into uppercase and into a list. So asking for two tasks first can work this into uppercase, then split into a list. Let's run this first s dot pumper that from this one. So we have this in uppercase. Let's apply split here and we don't need to pass in any argument because we're splitting these words at white spaces. So this is our outwork, and he's asking for the same output could more distinct s into lower case and split at hash . So once again, the similar tasks Let's run this string forced. And we can copy this court again because this is the similar tasks instead of up are we need lower here. So we're converting the string into lower case and then splitting at you have to Boston hash as But so we're splitting. Attash, My name is Ozzy. And no, hi. Sign here. So in the next task, we have province equal to Alberta and population is equal to 4.5. So we need to print the total population of Alberta is 4.5 millions. So there are some instructions given create placeholders inside the string in the plain statement passed in the initialized variables which province and population to the former to fill in the placeholders. So let's initialize thes want and right bring statement here and the Toto population off. Now here we have a place order because we have province. So is again the population. We need another place holder here. This is dot at the end, we want dot as well not informant and Rolince and be positive population. Let's bring this for the total population off Alberta is 4.1. We're missing 1,000,000 here. India. So the total population of Alberta is 4.1 million. So we guard the same and toe. This is twice output. So we don't need to worry about this thing. We can begin. Copy this and again. Paste it like this. So we have two times is awful. Can you get Canada from the nested list using indexing. So this is our list here, and we want to gap Canada. So let's from this list first. No, we need Canada Index one to three and four. So 012 and three. What we need. We need something e at index. A place for which is indexed three. So we have can it out here. Now we can further index on this list here. Zero and what we want. We want one here one and it's very simple. Law zero. So we got Canada in the output this name off provinces which AKIs actually from the dictionary below. So it's very simple again. We know keys and values matter, so we can simply let's run this dictionary force. We need to run this self us so that we can, uh create a dictionary. So D dart keys. So we want the same output. So let's pass into the list. So we have the list off keys in the output from the nested dictionary. Grabbed the world. Montreal. So we have this dictionary. We need to grab the world launch. Let's see, what is the key for Montreal? Fast? Because because dictionary is a key value pair and we need to excess Montreal through its scheme. Okay, One, This is the first key value pair, and this is our second key value pair. So this whole list off dictionary off list is actually associated with cakey care to, so we have to de get do something went wrong. Let's see if we need to run this again. Yes, we need We didn't run the dictionary before, so now we have d care to and we get the Montreal in. Kato. Now, if we look at this output, we have a list that index zero. We have one at index one. We have this complete dictionary. Let's do the further indexing and pass in war. Okay, We got the dictionary and Montreal within somewhere in the dictionary. So now we have a key again we can call key again BC So we got Montreal in our output. Now, if we look at this list again, we have ske zero well and on one to and then a dictionary again at 0123 Let's further index and this is three. Now we have a dictionary with key as calorie and value in this list. 123 Montreal. So he lets passing salary, which is a key. It's misspelling here. Okay, we got Mark Shell in this one, and now we can simply index 01 toe. Three it is. So we got more chance off, but this is a little long. It's it's nested, but it's kind of very deep nesting. Let's move on to the next one. What is the main difference between the two pull and the list I hope you remember to pull is immutable. Where list is mutable, we can change the list, but we can't change the Topol. We can add element in the list. We can't air it or replace or change the element or the item in the tupelo. So the next one is an element can appear multiple times in a set This is false because set contains the unique element. Only if we have three or four times any number, it only appear ones in a set. Let's move on to the next one. You got email address something user name at some domain doxy. Write a function to split the website domain. So this is the website part and we need to separate this part. Remember, we can use split, but he's asking for to write a function. So let's write a simple function. Oh, he has given get do man. Let's try to function, get domain D E f get domain and then passing e mail, fallen hair and what we want in return it are e mail. Do not split and we want to split at that sign. Okay? And let's call this function that in the same block. So we have user name and sometime in name dot cso. We only want the second part in this list so we can passing minus one here. Kennedy's so we have written a function called it here and we got the open is the same. Next we'll want to the next question. Can you write a function that tells you If there is a world Calvary in the provided string how to deal with the World City? Or I think it should be Calvi. If Calgary is capitalized so clear to function past history as to the function in orderto Akon for capitalization, we will use lower and split at white spaces. So this is him. Let's create a string first. Yes, equal to this string. Try to function the e f find city passing this string. Caller it on Calgary in S I thought floor dealing with capitalization here converting everything in this thing to the lower case and then split the quite space unless all this function find city and passing this string s yes. So we have a string hair, We define a function Fine city bid one argument return Calvary dealing with the capitalization splitting at white space. So we have a list and we are finding out if board Calgary is in the list And if the board calvary is in string as we get true So let's move on to the next one. Right. A function to return square off numbers from 1 to 5 use range method here. So we want to use range method here and we want right to function square. We have already written such function in our previous lectures. So let's start with writing a function. The Square Boston Better me too. Number sq equal toe initializing a list so that we can apparently squares off the numbers in P. Graham for lum being be ram for Luke numb dot What we want to bend. We want to upend with numb sq a pen What we want to upend Numb square because he's asking Quisqueya and then we want to return. This is this and this was que No we want to return what we're getting from this for Luke and let's call the function in the same block square is asking for a range 12 five. So if you want 1 to 5, we need to pass in 1 to 6. Here it is. So we're getting one for 9 16 square off. 12345 Okay, The next question is write Lambda expression for the function above use map and range. So for this function, he's asking far too right a left expression. So we have written the same expression in Ah, our fightin essential lectures. So let's start with writing Lambda Expression Linda. But numb. What do you want? Numb Square. Okay, let's boss into map and we know map needs to arguments. And the second argument here is range because this is our second are Let's go, please, and peace to you too. So map first argument is a function it lemper expression here, which is returning square off number. And the second argument is a list on which we'll kill. Little square this passing to a list so that we can get the old activities. 2469 So we need scare. So it should be to aesthetics. No, here it is. 149 16 and 25. That's one wanted the next one build of the wars from the list that starts it. See, we have a list vaginal ist, and we want to filter the world that started. See, use Lambda expressions and filter, and our output should be cabbage and chicken. So this is our base. Let's run this court first. Now we have least let's start with the Lemper expression again. Lambda Ward Award. What? We want to know the first corrector. See, I M. We want to take these 1st 1 so we can index on strings. So this is index zero. It's award at zero. What we want equal to see and then which list? So we have the limped expression to check if the first letter is C and the veg list that's passing to filter and then bus in this whole court to list. Now we have filter. We have first argument Lemper expression to check the first letter C virtual ist and then Leah passing into list to print. So cabbage and chicken we got our output. So let's move on to the next question. You are a loyal customer and the store is offering discounts to their loyal customers. What are the discounts between zero and 50 Canadian dollar? 10% discount between 5120 person, more than 100 40%. And if it's Monday and you're spending more than 50 Canadian dollar, you get cherry on top $5 off. You need right function to calculate. Whole musty customer will pay for any spending. Yes, little tricky. You need to develop a logic first if needed. Take a pen and normal and write down the logic After writing a function you need to test if unction on this list. 50 fifty one hundred 101 So I already have this function written here. Let's go through the cord. Define you. Pay is the function name. We're doing calculations on spending, and the second argument is, if it's Monday, are not so. If spending is less than 51 like zero and 50 which is less than 51 return spending minus 10% discount on spending. This is simple. And if it's Monday today, then we're getting $5 discount. But if spending more than 50 so Monday today and spending creator equal to 51 for end, both conditions must be true. If they both are true, our spending is actually spending minus five, because we're getting $5 off. So we have new spending, which is equal to spending minus five. Els. If it's not Monday, we have New spending is equal to spending, so we're not getting any discount, and our new spending is same as spending, which is initial value here. So if spending is greater than 50 and spending is less than 100 once again, both conditions must be satisfied. We're getting 20% of school. And if spending is not between 50 and 100 it's more than under. We're getting 40% discount. So this is our function. Let's run this function and do the test here. Best 50 51 50 test 50 5100 and one Deal one. And let's from the four loop here on test for numb in test print for Numb, which is 50 for force Element you pay calling the function passing in number. Argument falls mean it's not Monday. So if we run, we're getting this output, which you see him, what is given. So if it is on Monday, were passing true. Let's copy this one. Yes, you too. Yes. So old function is returning the value after discount, which is a charity. $5 Further discover. So great job, guys. I hope you got a very good understanding on biting basics. Let's move on to the next section. See you in the next lecture. Good luck. 18. End C 1: