Learn Python In 120 Minutes: Complete Python Programming | Mohammed Tahir | Skillshare

Playback Speed


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

Learn Python In 120 Minutes: Complete Python Programming

teacher avatar Mohammed Tahir, Full Stack Developer & Instructor

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

78 Lessons (1h 55m)
    • 1. Introduction

      0:38
    • 2. What is programming

      1:23
    • 3. Note 4 Noobs

      1:42
    • 4. Quiz

      1:45
    • 5. Online IDE

      1:35
    • 6. (I)_____Basic Concepts_____

      0:14
    • 7. Hello World

      0:38
    • 8. Comments

      0:57
    • 9. What are data types

      0:37
    • 10. Data Types

      0:57
    • 11. Type Casting

      1:25
    • 12. Variables

      1:59
    • 13. String Operations

      2:05
    • 14. Pycharm

      0:24
    • 15. Quotes and newlines

      0:50
    • 16. F String

      1:39
    • 17. String index and slice

      1:19
    • 18. Arithmetic

      1:14
    • 19. Quotient Reminder & Expo

      1:29
    • 20. Operator Precedence

      0:44
    • 21. Input

      0:50
    • 22. (II)_____Data Structures_____

      0:52
    • 23. Tuple and list

      1:34
    • 24. Set

      0:48
    • 25. Dictionary

      1:19
    • 26. Immutable vs mutable

      1:18
    • 27. Recap

      1:06
    • 28. Operations on dict

      1:54
    • 29. Operations on list

      2:11
    • 30. List Index & slice

      1:39
    • 31. (III)_____Control Flow_____

      0:20
    • 32. Booleans and comparison

      1:47
    • 33. Logical Operators

      1:15
    • 34. Inplace operators

      0:54
    • 35. If Else

      2:40
    • 36. Elif

      1:30
    • 37. Multiple Conditions

      1:20
    • 38. For loops

      2:48
    • 39. Range()

      0:46
    • 40. Loop Over Dict

      1:14
    • 41. Iterables

      1:20
    • 42. While Loops

      2:55
    • 43. Continue, break

      1:22
    • 44. While vs if

      0:37
    • 45. (IV)____Functions & Modules____

      0:12
    • 46. Functions

      2:24
    • 47. More on Functions

      2:42
    • 48. Default Arguments

      1:07
    • 49. Return

      1:47
    • 50. Docstring

      1:54
    • 51. Pass

      0:21
    • 52. Functions Recap

      0:45
    • 53. Global and local variables

      1:09
    • 54. len() min() max() round() abs()

      2:30
    • 55. zip() map() filter()

      4:32
    • 56. Methods

      1:09
    • 57. Modules

      1:10
    • 58. Importing Module

      1:35
    • 59. Create and Import

      2:28
    • 60. Random

      1:24
    • 61. Time and datetime

      1:50
    • 62. Python Standard Library

      1:03
    • 63. (V)____File & Exception Handling___

      0:10
    • 64. Reading a file

      1:07
    • 65. Write and append

      2:33
    • 66. With

      0:43
    • 67. Type of Errors

      3:45
    • 68. Try & except

      1:44
    • 69. Exception Handling

      2:36
    • 70. Finally

      1:05
    • 71. Errors in Python

      2:46
    • 72. Raising Exception

      1:31
    • 73. (VI)_____Additional Concepts_____

      0:14
    • 74. List Comprehensions

      3:41
    • 75. Lambda function

      3:38
    • 76. Zen of python & pep 8

      0:35
    • 77. Project

      0:53
    • 78. What's next ?

      0:32
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

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

24

Students

--

Projects

About This Class

In this class we will Learn Python from the scratch the class is completely for noobs so even if you don't have any prior programming experience or never written a single line of code you will still be able to understand and follow along 

Class Content: Entire class is divided into 6 modules and in each module we will have couple of lessons

  • Basic Concepts
  • Data Structures
  • Control Flow
  • Functions & Modules
  • File & Exception Handling
  • Additional Concepts

What You Will Learn:

  • Data Types(String, integer, float)
  • Input
  • Variables
  • Arithmetic¬†Operations
  • Tuple
  • List
  • Set
  • Dictionary
  • Operations on tuple and dict
  • If else & elif¬†statements
  • For loops
  • Range()
  • While loops
  • Continue, Break
  • Functions
  • Return
  • Global & local variables
  • Built in functions¬†
  • Modules
  • Random
  • Time & Datetime
  • Python Standard Library
  • File Handling
  • Errors in Python
  • Exception Handling
  • Raise Exceptions
  • List Comprehensions
  • Lambda Functions
  • Zen of python PEP 8

Meet Your Teacher

Teacher Profile Image

Mohammed Tahir

Full Stack Developer & Instructor

Teacher

Hello, Tahir here.. I'm a full stack developer and digital marketer working with technologies such as Python, JavaScript, SQL, html, CSS and various frameworks in these technologies. I am a self taught programmer. And I strongly believe in "The best way to learn any skill is to learn by doing" so most of my classes are and will be project oriented.

See full profile

Class Ratings

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

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

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

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

Transcripts

1. Introduction: Hello everyone. Welcome back to this series of Python from helloworld, real-world. In this class, we are going to learn Python from scratch. The whole class is divided into six modules, which is basic concepts, data structures, control flow, functions and modules, file and exception handling and additional concepts. And in each module we will have a couple of lessons. Now don't get owned by looking at the size of this content. There is nothing in here. Most of the lessons are going to be quite short and straight to the point. And along with that, you will get access to a quiz program to enhance your knowledge in each module. So it's going to be fun and I'm really excited for this, and I'll see you inside the class. 2. What is programming: All right, so what is this programming? Programming is all about communicating with the computers, like we do with the hormone links. Now to communicate with any human being, we first have to learn the language which other person can understand it. It might be English, Hindi, Spanish, Arabic, whatever. So to communicate with the computers, we first have to learn the languages which computers can understand. Not to learn any natural language, we first have to learn its grammar, right? So to learn any programming language, we first have to learn its syntax. Now this syntax on nothing but a set of rules which we have to follow in order to successfully execute our program. Creating a program is quite similar to creating a recipe. Let's say want to cook the pasta. And these are instructions when you follow all these instructions correctly that the outcome will be a delicious pasta. Let's, we want to create a program. We did just prints out the square root of all the numbers in the data. So here you define the instructions, and computers will blindly follow all these instructions. And the output will be the square root of all the numbers from data. And this is exactly what we're gonna do in this series. We will learn a set of rules which we have to follow in order to successfully execute our program. And based on whatever we have learned, we will build something meaningful, something exciting. 3. Note 4 Noobs: Well, if this is your first programming language, then I gotta good and a bad news for you. I'll go read the baton first. The bad news is, it is going to be a little bit difficult for you. And you will have a lot of questions. And sometimes you start feeling like, well, I was here to build some cool stuff citizen by them. And he is just teaching me all the basic syntax isn't. And it's perfectly fine to have that kind of fill in because he will divide these concepts and we'll learn them individually. Lagoon look at loops individually, functions, conditional statements, data structures, exception handling, and all the other concepts individually. So it may not make sense to you. Like right now, isn't making any sense to you. But when we build something meaningful, will combine all these concepts together and then it will surely make sense to you. And the good news is, at the end of the day, all the programming languages perform. The same job is communicating with the computers. Different languages have different V of communication and different purpose of communication. So if you learn one programming language, then it will be quite easy for you to switch to another language, the first language, which island was Python. And learning JavaScript was quite easy for me. I learned all the fundamentals of JavaScript within three days. Because most of the concepts that were quite similar, the code which we have written here in Python performs the same job as the one which we have written here in the JavaScript. This is how a different syntaxes and different V overrepresentation. So just stick with me. Don't get demotivated. And trust me, reveal good, some cool stops. 4. Quiz: Well, in the resources section, you can find a zip file, this downloaded and unzip it. And you will find this quiz dot py programming that zip file. Just double-click on it. But we execute this program. You should have Python installed in your computer. And for any reason you're not getting this kind of interface, then you can just open up your terminal and type python. Again, Python must be installed in your computer to execute this program. Drag and drop it here. It end up. Now here it will ask me on which topic I want to quiz about. Let's say I want to quiz on the basic concepts. So here I'll just give it as one, it enter. Now here you can find the quotient and these are the options. And here you can enter the answer. Now until you don't give it a correct answer, it'll keep asking you the same question. And once you give it a correct answer, it will move to the next question. And we want to restart this program. You can just do it as a 100. It end up. Now I want to quiz about, oh, that's a control flow. And to exit this program, you can just ender ripple on, hit enter. Now here it'll show you the number of successful attempts and the number of failed attempts. You can just open it with the notepad and have a look at it's source code or door to get overwhelmed by looking at this program. There is nothing in this year. Once you understand the concepts of object oriented programming, you can understand this program as well. And if you don't actually know what does a piece of code performs in this program than don't try to disturb it. Now, a husband, a lot of time grading this quiz, so make sure you use it and get the best out of it. 5. Online IDE: Well, to create and execute Python programs in your computer before stopped installed Python and some platforms such as code editors are IDs to create and execute our programs. And if you already have a setup in your computer, you can skip this tutorial utterance kinda formal last class which is on Python environment set up. And if you don't actually want to install Python on right now and just want to get started with Python quickly. Then the best option for you is an online IDE. So just go to this link which is a rebel dot id. And of course we have several other online platforms in which we can create it execute or Python programs. But it is Rebel idea is widely used and it has a great interface. And go to these languages, choose Python. Now we're going to head over to this link it masker to create an account just graded and login. And you will have this kind of interface. And here I'll just name might Apple as a lone underscore Python. Credit rebel. Now here do it. Create a python file for me which is a main dot PY. And here we can write our good can this one. And he will get the output. And here you can create a new file, auto New follow, if we just click on the settings. And you will have a couple of options here. Like you can change the TM2.org or change the font size and make sure this code intelligences. And about now for a couple of tutorials, we will use this platform and then we will move to pi chomp. 6. (I)_____Basic Concepts_____: Well enough introduction. Now let's just start learning Python. So in this model of basic concepts, we are going to learn about the data types. We are going to look at strings, variables, and some arithmetic operations. These are going to be quite basic concepts. So let's jump in. 7. Hello World: All right, so now we'll start learning Python by printing hello world. To print anything in Python, you just have to call you a print statement, followed by the parenthesis braces. And if it's a textual data, then you have to include it within single or double quotes. Hello World. And run this. Now you get the output as helloworld. If it's a number, then you can include Without these courts. And on this. So basically when you include anything within single or double quotes, it's data type will become string. So what all these strings, Well, we will learn them in a wine. 8. Comments: Before moving further, let's have a look at Cummins in Brighton. So here we have to kind of convince which is a single line and multiline, but waterless commands. Well, these are the lines which we write for our older friends and it will not be executed. To create a single line comment, you can just call your hash or whatever you right after this hash will be considered as a comment. If I just print your spam and run this. Now here it will only print spam. To create a multi-line comment you can just call Drupal. Single quotes are double-quotes. Now what do we do right, within this course will be considered as a, this is a multi line comment. And on this, now her to only print spam as these will be considered as comments. 9. What are data types: What are these datatypes really in simple words, these are nothing but avail of representing values. Like in physical world, we have text, we have numbers, we have decimal numbers. So in Python, string represents text, in digital represent number, and float represents the decimal number. Like in physical world. These are not the only way to represent values, right? We have several other form of representation of values. It might be symbol or anything like that. So in Python didn't know the only types of data which we have. We have several other types of data. So as we move further, we will go on covering them as well. But these are quite oftenly used and basic ones. 10. Data Types: Well, it's a novel recover data types in Python. Fundamentally, there are many types of data in Python, but these three are quite often used and basic ones, which includes STR, again, string, integer, and a float. If I just print your iPod Hello and run this. Now here it will give us its type as a string, which is STR. If I replace this hello, read some number, written this. Now also its type will be a string. So when we include anything we didn't single audible goods. It's DID data will be a string. If I remove these goods. And this amount will be integer. So these into represents numbers in Python. If I just adding a 0, rerun this. Now it will be float. So this float represents decimal numbers, the numbers with the decimal point. 11. Type Casting: All right, so now we will learn about typecasting, aka data type conversion in Python. This typecasting is all about converting the data type of a particular data from one data type to another data type. Well, take it easy output and show you how does it actually works. Or query a variable called x to which I'll assign ten as value. Do whatever it is variables, we will explore them in a while versus print your x. And along with the type of this x. And run this. Now here we will get its type as an integer. If you want to convert it into string, then you can go like STR of ten. Again, it will convert it into string. If we want to convert it into float, then you'd have to call your float and included this term within the parenthesis. Let's see if it's a float. And you want to convert it into an integer. And what is right will only include ten. And it will convert it into an integer. It's a string, and you want to convert it into an integer. This is, strings can be converted into integers and floats as long as it has only numbers. If you add any text and try to run this, it will throw you an error. 12. Variables: Welcome back. So now we will look at variables in Python. For now, just assume this variables as containers which contains some data, which holds some values. To create a variable. In Python, you can just define it name and as an a value of two that if I just bring this age and run this muddle through MY name error because variables are case sensitive. If you have created a variable using lowercase, then you have to call it with the lower gets itself. I'll create another variable called age too, which I'll assign 19 as value. Written this. And we'll select the one which has been recently changed. You can even assign a variable to a variable like x is equals to its. And here if I print x, it will give me the value of our variable age, which is 19. Now there are certain rules which we have to follow in order to create the variables. A variable should always start with the alphabet from a to Z or an underscore. And it can only have the alphabet from a to Z, or a special character which is underscore, or the numbers from 0 to nine. And it cannot be empty. Like if I create a variable called y. And if I try to run this and it will throw me era. And if you don't have any kind of content to add to a variable or a value to assign to a variable. You can just call him none. But it cannot be empty. And it cannot have spaces. You cannot create a variable like SSB. Instead, you can go like a, underscore B, and you cannot use any special keywords like form, are, while, or if. Now these are some special keywords which has meaning in Python, you cannot use these keywords. 13. String Operations: Well, so now we will cover operations on this spring for that here I have created a variable called x to which I have assigned a string which is hello world. If I just print here D of x and run these. So these are the different operations which we have in this tutorial. We will discover few basic ones. If I call you a x-dot lover. And run this, it will return all string in a locus format, symbols with x-dot upper. It will return all string in an uppercase format. X dot capitalised will capitalize the first word of the string. And then we have x dot split, split of a string based on the parameter which we pass here. A low One thing, I'll just add a comma Python. And here I want to split my string based on the coma. Not we'll iterate through the spring and wherever it finds coma, it will split that. I'll add one more comma and runs again. Now it will split our string into three, which is Hello world and python. And then we have a x-dot replace. Now here we need to provide the verb, but you want to replace. And with the word which we want to replace. My dual iterate through the string and wherever it finds, oh, it will replace that OVD B. I'll add here some spaces before and after the text. And R1 is made will include all the before and after spaces. If a call your function and brand is. So basically it will skip all the before and after spills and give us the text of the string. So these are the different operations. Just go ahead and play around him. 14. Pycharm: Rather from now, we will write and execute or programs in Python. You can still continue with the online IDE. Or if you have any platform in your computer, you can go ahead with that as well. Or if we don't actually have any platform and you want to set up an environment into a computer. You can put a thermal last class of Islam by them end moments at a. And here I'll just move it to right bottom and top effect. Now we're good to go. 15. Quotes and newlines: Let's have a look at how we can include quotes and newlines in a string. For that here I have created a string which is, I'm learning Python for this Rwanda is, it works both, uh, but what if I add Hill, a single quote, Android on this? You do throw me syntax at up. One thing that I can do is I can just great Austrian using double-quotes and rerun, this might works perfect. But what if I include this byte and within the double quotes? Again, it will be messed up. So the best way to include these goods within a string is a grading, a backslash and a coat, adding you a backslash and a good. And to create a new line, you can just call heel backslash n. On this button, you will loop, print it in the next line. 16. F String: Well, so now we learn about from my deterrents in Python. For that here I have created two variables, which is Nim and age to which I have assigned John and 18 as value. If I wanted to print out John is 18 years old and he yak and go like print. Name is plus eight years old and run this. Well, we have to make it at a String and rerun this. Here will get the output as John is 18 years old. But this is not the best method to perform this kind of tasks like here, we have to call this plus sign and make sure all the data type matters. So it's not the efficient way. We have. Another way in which we can perform this task. Here we create a string and we didn't actually create an empty curly braces either. Another empty could liberate years old no to the string we call dot format and pass Nim coma. And run this. Now you will get the output as John is 18 years old. But this method is pretty much all. We have. Another way in which we can perform this task, which is an upstream. So here we create an F and a string. And we didn't, which we created an empty curly braces invisible called Nim is, is years old. Now here will get the output as John is a genius fold. So whenever we want to perform this kind of tasks, we will go with epsilon. 17. String index and slice: All right, so now we'll have a look at string indexing and slicing. If I just print here text. And within the square brackets and pass 0 on this, that will give me the first element of this string, which is P. Remember that in biotin, or more precisely, in most of the programming languages, the positive counting starts from 0 and negative counting starts from minus one. If IDEO for written this and that'll give me the fifth element of the string, which is a o if idea minus1. And one is, that will give me the last element of the string value minus three. Now it should give me F, perfect. It. Let's, if I want to access this is word from this string, then here I can define its position as a 101234567. So when colon nine and run this, and that will give me all the elements are within this range. If ITO 0, colon six and run this. Now don't give me all the elements within this range, which is Python. So basically this string indexing and slicing is all about calling the elements of a string based on their index. 18. Arithmetic : Alright, so non-real globalism ultimately operations in Python. In this tutorial we will look at addition, subtraction, multiplication, and division. If I just created a variable called x to which assign 15 as value and y two, which I'll assign phi as value. If I just bring to your X plus Y. And on this, but it'll print out 20. X divided by y will be three. But what if I make it as a float? And written on this? It works perfect because we can perform all the four operations between an integer and a float. What if we have, let's say a string called Hello. Rerun this. It will throw me a type error because the only operation which we can perform between one individual and one string is that we can just multiply them. That's it. Read on this not will print out Hello 15 times. Let's make it this 15 as a string. Data on this. Again, it will be messed up because the only operation which we can perform between two strings is we can just add them. Now here it will give me 15 hello. Now the additional strings is also referred as string concatenation. 19. Quotient Reminder & Expo: Now that we have covered a few basic arithmetic operations, let us have a look at some other operations. So whenever you perform any division, you have basically four steps, which is a dividend divisor, quotient and reminder, most of the time we know our dividend and divisor and we are asked to find out question banks reminder, invite them. We can find questions using double following slash and reminded using Constantine vs sprint here. Let's say, I'll dig symbolism and 759 on this. So it's question does it? And it's reminder isn't three. Perfect? And then we have exponentiation. Now, I don't know what to, how do you call them, but to views, to refer to it as a two raise to the power of two is of this N phi isn't exponent, so it'll multiply this two into two phi times two to 22 to 44 to 88 to 1616 to 32. We can perform the same in Python using double asterisks. If a call here, two, raised to the power of fire and run this. Now will display me 32 if idea, let's say a 100. And we run this. Well it's a, it's a huge number, but this is how you can perform exponentiation and defined quotient and remainder. 20. Operator Precedence: Well, if I just print here two plus two into phi o, now the answer which we are expecting is 20, but if I run this, it will be tall. This is due to operator precedence in which it follows bought MOS. This is the BOD Mao's rule. According to this rule, it will first perform the expression within the brackets, and then it will go for order, division, multiplication, addition, and subtraction. Now according to this rule, it will first go for multiplication, which is a two into 51010 plus two tall. But if we want to perform this expression first, then here you have to include it within the brackets and run this not will be 20. Well, it's not a new concept like we have learned this in high school mathematics. 21. Input: All right, so let's have a look at how we can input in Python. For that. Yeah, I'll just create a variable called user underscore input to which I'll assign an input in which a, right, and a. And here I'll just print user input and run this ad here, bloom it NDA, but we'll print out Bloom. I'll just multiply the user inputted due to and written this, adhere to their gonna guess what will be the output? Will it be due to a fall or something else? Well, it will be 22 because by default the data type of this input is a string. So if are taking integer as an input, then you need to define it all here. And written this adhered to it enter. Now it will be four. 22. (II)_____Data Structures_____: All right, so now we'll explore data structures in Python. Before that, I hope you have gone through the cuisine basic concepts. Now what are these data structures? Well, now that we have covered the datatypes environment like we know about the strings, we know about the integers and floats. So we need something to store these data, right? So these data structures are nothing but disruptors in which we can store the collection of related value. Assumed this data's fructose as the boxes that we have different kind of boxes to store different styles, right? We have dividend boxes for the mobiles, 40 laptops for the air conditionals. So here we have different kinds of data structures to store our data in a different manner. All these data structures have their own characteristics. So in this module we are going to learn about tuple list, dictionary and said, these are the four building data structures which we are going to cover. 23. Tuple and list: Welcome back. So now we will learn data structures in Python. So here we have four built-in data structures, which is tuple, list, set and dictionary. In this tutorial, we will learn about tuples and lists. For that year. Others create a variable called X-Y-Z too, which I'll assign a Tuple. Now to create a tuple, you just have to call him a bracket. Now within which I'll add an integer and a float and a string. If I just print exquisite. Along with the type of exquisite. And one is. Now here we will get its type as a tuple. I've removed this braces and we run this. Now also its type will be a tuple, because when we assign multiple values to a variable that will be stored in a table. Now, to create a list, you just have to include them within the square brackets and rerun this. Now there will be in a list. Now by looking at this, you might feel like this tuple and lists are quite similar but they are not. There are huge differences between these tuple and list. These tuples are static and immutable. Like if you store some data in a tuple, you cannot update it. Unlike lists, which are dynamic and mutable, we can apply many functions on this list and manipulate the data. We will learn more about these lists in a wine. 24. Set: Well, so now we will explore the set data structure to create a set visitor, to create your curly braces. And we didn't, which are white to 3.6 and spam and run this. Now one of the few properties of this set is an ordered. Here we have 2.63 and spam. But here we've got like Spam, 2.62. Every time I run this, it will shuffle the values. And another property is it cannot have duplicates. Like If I add here two comma 3.6 comma phi u and run this. It will only include the unique values. Now we don't use this set more oftenly. And it is completely my opinion. Although data such as I imported it, I'll use under some circumstances. 25. Dictionary: All right, so now relook at dictionaries invite and all the data structures which we have covered so far, encoding, tuple, list and set had values. But in dictionaries we have keys and values. Suppose if I want to store the data of a person, then I can store it in a dictionary. Or to create a dictionary, you just have to call you a curly braces within which we can define the key and assign a value to that key. Now here I have created a key by name, name to which I have assigned bundy as value. I'll get another key by name, age too, which I'll assign A1 has value. And country. India. If I just bring to your person along with the type of this person and run this. Now you will get its type as dictionary. To access the kids from a dictionary you can just call here dot keys. That will give us all the keys from edX ND, which is name, age. And contrary to access the values from a dictionary, we can just call here dot values. Now these dignitaries are mutable. We can perform many operations on these dictionaries and manipulate the data. We will learn more about operations on nutritional trends in Hawaii. 26. Immutable vs mutable: All right, so what are these immutable, immutable objects? Will immutable objects are the ones when we equate them. We cannot update its value. Like if I create a tuple in which I'll just add some random numbers. And immutable does not mean that we cannot create another variable with the same name and assign a different value to that. It doesn't mean that because here we can do that. But what we cannot do here is we cannot disturb the data which is already present. Like if I want to replace this one with two non-Buddhist, if we're just print here x and run this, it will throw me a typewriter which has ripple object does not support item assignment because tuples are immutable. But what do we have here? A list. Later on this, it works perfect because these lists are mutable. I'll just assign it to a string called Hello. Now, I want to replace this edge with the letter J. Radon is, well, I can't do that because strings are also immutable. Immutable objects are the ones when we equate them, we cannot update its value. And mutable objects are the ones. When we grade them, we can abrade its value or we can manipulate the values, right? 27. Recap: Well, so let's just quickly recap all the depth of data which we have covered so far. But now just as good as editable appropriately because we are going to learn about it enables in the control flow. So heavy half strings, which is nothing but V over representation of text. And then we have indeed has two represents number and we have flow to represent decimal numbers. And we have tuple, which is an immutable sequence of objects, not invite and everything is considered as an objects. It might be a string, integer, float, set, a dictionary tuple. Liberally, all the types of data is considered as objects. And then we have list, which is a mutable sequence of objects. He also is store the data in a sequence separated by comma and they are immutable. And then Biao sandwiches, unordered set of distinct objects. He also we store data in segments separated by the comma and the are mutable. And then we have dictionaries, which is a bit of keys and values. Here we have a key and a value assigned to that key. Alright, so I hope you are clear with this and I'll see you in the next one. 28. Operations on dict: Welcome back. So now we'll have a look at the different operations which we can perform on the dictionary and manipulate that data. If I just print here, DIR and around this. So these are the different operations. We have already gone through keys and values and among all of them does get atoms and update are important. So we'll cover these operations in this tutorial. If I'll just call here dot items. And I'll just remove this d pi r and run this. So basically this dot items will give us all the keys and values of our dictionary in a tuple format. If a call here, dot get, and here I'll pass, is within parenthesis. That will give me the value of our key is we can perform the same plasma equating a square bracket here. And including this age within the square bracket. Let's say we're bundy have moved to the United States and we need to update the data for that here we can just call this person dot update country. You as a brain poison. And around this nut will update the value of our D country. Let's if I add your citizen which is not present in our dictionary. And try to run this. But we'll add this citizen at the end of our dictionary. We can perform the same task, but creating a square bracket here. Citizen is our key, and USA is our relative. Perfect. So that's it. And I'll see you in the next one. 29. Operations on list: Hello everybody, welcome back. So now we'll cover operations on the list. Here. I have mentioned few important of them throughout this tutorial, we will cover these operations for that he others go into a list called myList. It, which I'll store, let's say to 3.5. some random numbers. Now one of the most used operation on lists is a dot append. If adding 015 and print mylist and run this. Now this 15 will be added at the end of our list. And then we have dot extent. So as the nims is, we use this dot extend to extend our list. Like if I create another list, a limit as x, five comma six miles dot Extent X, and run this. And it will combine both of these lists. Well, it's not really necessary that both of these must be a list. Like if I make it as a tuple and run is null, so it works perfect. We can even perform this between a list and asset. And then we have dot insert. Notice dot insert is quite similar to dot append. But in the append values get added at the end of the list. But in insult, we can define the position in which we want to add, the value and the value which we want to add and run this. Now this phi u will be added at the first position. If I define a position as one and run this. Now this phi u will be added at the second position, but it will not remove this 3.5. insert. It will move to 3.5 to the third position. And then we have dot pop. Using this, we can skip the element of a list based on their index, like if add here 0 index and run this, let us keep this to print out remedying all the elements. If I define the index as one and rerun this, we'll skip this 3.5 and print out all the remaining elements. And then we have dot sort not will give us the elements of a list in ascending order. 30. List Index & slice: All right, so now we will cover list indexing and slicing. It will just print here x and it within the square bracket outbox 0 and around this. And it will give me the first element of all list, which is two. If I define the index as ten and run this and it will throw me index at list index out of range, because here we just have seven elements. If I define the index as, let's say, minus three and run these nodal. Give me this for, let's say I wanted to access this spam from the list, then I can define its index as 0123. Let's try to access this spam using negative indexing, which is minus one, minus two, minus three, and minus four, minus four. And a run this, it will give me spam. And then we have slicing. Let's try to access these couple of elements from the list. Then here we can define its index as 012345. And a run is not will give me it spam. And four. If I just defined here minus two, which is minus one and minus two, and run this and it will give me eat spam and for, and what if I removed this minus2 and run this? And it will give me all the elements after it. What if I just only add here a colon? Now we'll print out all the elements of the list. So this list indexing and slicing is all about calling the elements of a list based on the index. And we have covered this in the strings as well. 31. (III)_____Control Flow_____: Hello and welcome back. Congratulations, you have already covered two modules. In this module we are going to explore control. We will look at another type of data in Python, which is booleans and some operators. And we will explore conditional statements, also referred as decision-making for loops and while loops. So all of that and more, I'll see you in the next one. 32. Booleans and comparison: Hello and welcome back. So before moving further, let us have a look at another type of data in Python, which is booleans. Now these Booleans are quite simple and straightforward, like they can be true or false. And we can get them by comparing two values. So here we have six comparison operators which is equal to, not equal to, greater than, greater than, or equal to less than, less than are equal to what this grittier or variable called XYZ ID two, which assigned 21 is equal to 21. And print your x, y, z. And one is. Now here it will display as a true, which is quite obvious like 21 is equal to 21. If idea 21 is equal to 23, and run this, now it will be false. 21 is not equal to 23. Not will be true for just print here. Exquisite type of excited. Now here it will be a bull, which is a Boolean. Now along with this, we can even compare two strings. Spam is equal to spam on this night will be false because here we are using uppercase S And here we are using lowercases. So here also I'll add uppercase or it'll be true. Now using these comparison operators, we can literally compare any values in Python. And they are really helpful in conditional statements to check if a condition is true or false. And along with this comparison operators, we have some other operators. We shall see them in the next tutorial. 33. Logical Operators: Now that we have covered combatants and operators, let us have a look at this logical operators. So here we have three logical operators which is not and are. Now just logical operators are used to check multiple conditions. If a call here, 21 is equal to 2123 is equal to 25, and run this. Now it will display me false because when we use this and operator, both of these conditions must be true if a qualia are. And run this. Now it will be. Now this odd operator. We'll check if any of these conditions is true, then it will return as a pro. And then we have not operator. Now this not operator is really confusing. If I run this. Now it will return false. If idea 21 is equal to this number. And run this now told return us a probe. So visibly, if the condition is false, then it will return true. And if the condition is true, then it will return false. I hope you are clear with this and I'll see you. 34. Inplace operators: Well, so now we will have a look at in-place operators, which are also referred as assignment operators. Let's say I want to update the value of XYZ to 30. Then here I can just call exquisite is equal to exquisite plus nine. Andon is. Now there'll be 30. I can perform the same task by adding plus sign here equal to nine. Remember that there should not be any gap between this plus and equal sign and this null. So it will be 30. If adding a minus sign and the value is 11, and run this not will be ten into two will be 42. So basically here we define the operation equal to sign and the value. We use these more oftenly in looping. 35. If Else: Hello everyone, welcome back. So now we will explore a conditional statements in Python. So here we have basically three statements, which is if, else, and, and if. So, what are these conditional statements here via provided certain condition. And if that condition turns out to be true, we will execute certain lines of code. And if that condition turns out to be false, we will not execute it. We will just skip those lines and move other. In this tutorial, we will learn about if and else statement. How to create an if statement. You have to keep in mind about these stops all Hill, which is a statement. Since here we are creating an if statements and we will call it if keyword, followed by a condition and a column. In Python, this colon basically indicates that whatever you right after school on with respect to the indentation gap will be considered as a part of this code block. And we have this concept for almost anything like conditional statements, looping, functions, classes, and so on. And then we have indentation gap, which is nothing but just a gap, something like tabs or spaces. And then we have a return value. It's not necessarily that distributed values should be always a print statement. It can be anything. Well, they are optical part is always confusing or limited score until you have Does it actually works for that here I'll just create a variable called age too, which I'll assign, let's say 15 as value. And here we'll quit. If is greater than A1, then print. You are eligible for voting. And not what if this condition turns out to be false? That is, when the end statement comes in. To create an else statement, you just have to call Else keyword colon. And with respect to the indentation gap or return value. And remember that you cannot define any kind of condition to the else statement. So he will return. You are not eligible for ordering. Or run this. Again, we'll print out the statement as this condition turns out to be false if AD year, let's say 21, and run this. Now it will print out this line as this condition turns out to be true. I hope we'll close with this and I'll see you in the next tutorial. 36. Elif: All right, so now we will explore elif statements. But why do we have this concept of airlifted meant when we already have if and else statement. Well, there are some limitations to these if and else statements, like you can describe it if and else statement once. And you cannot define any kind of condition to this else statement. But you can create as many airlifted min steady want undefined condition as well. Now creating an elif statement is quite similar to creating an If statement, which is a keyboard with a leaf and followed by a condition. Now you are all provided the condition as if aij is equal to 17, then print two more yields to two more years to go. And if it is equal to 16, then he will print three more years to go. Run this will allow you 17 and run this. And I will print out the statement as this condition turns out to be true. If adding 16 and run this, print out this statement we as this condition turns out to be true. 37. Multiple Conditions: Well, so now we will define multiple conditions to the if statement. If it is greater than eight and h is less than 12, then print you are allowed. Or else print you are not allowed to run this. Now it'll print out the statement as these conditions turns out to be false if the audio and read on this. Now also it will print out this sediment. In order to print this statement, both of this condition must be pro audio n. And what is now it will print out this statement. If I replace this and with the r, and here I'll add 35 and run this model, print out the statement. When we use this R, If any of this condition is true, then it will become 0. Now here this condition which is greater than eight, turns out to be true, then it will result in drop. 38. For loops: Hello everyone, welcome back. So now we will explore for loops in Python. Does volumes are used to iterate through something. Now here I have a list of numbers stored in mylist variable. If I want to print out all these numbers, of course I can just call print my list, but they will be in a list if I want to print all these numbers one by one in a sequence than yak and go like four items in my list. Print atoms and run this not will print out all these atoms from mylist. Remember that this atoms is just a variable and it can be changed. But the condition is, you have to call that with the same name. And we can even iterate through a string as well. Text is equal to Python is fun for character in text, print characters. Now there's follows comes really in handy when you want to perform operations on all these elements individually. Let's say I wanted to multiply all these elements of a list into two then yak and just call for characters in my list. But in characters into two. Android is not. We'll multiply all these elements from mylist into two For characters in text. Character plus an x Clement remark. But we'll add an exclamation mark to all the atoms in text. Now we can even filter items in my list based on some condition. Let's say I wanted to print out all the even numbers from MyList. Then here can go like put characters in myList. If the character one divided by two and it's a reminder is 0, then print character. I'll do one thing. I'll just add here, print even comma character. Or else print odd comma character. And run this. Now what it does is it will check if this condition is true for two. And if that condition is true, then it will execute this block of code. And again, it will go back and check if this condition is true for this element which is six. And if that condition is true, then it will execute this block. Again. It will go back to this element which is three and check if this condition is true. If the condition is false, then it will execute this block and it will continue doing it for all the elements in myList. I hope you are clear with this and I'll see you in the next tutorial. 39. Range(): All right, so now we'll have a look at the range function. Does Rayleigh function will give us a sequence of numbers between defined arrange. And we often use this in the follow-up. Let's see if I want to print the numbers between 0 to 40, then instead of manually typing it, I can go like for i in range 40. But Int i. And one is, well, here I'll add a four to one, because here the counting starts from 0. Let's say if I just want the numbers from 20 to 40, then here can define it as 20 comma 40, 7n over. 40. Loop Over Dict: All right, so now we will look at how we're going to iterate through the dictionaries for items in data. Print Adams and run this. And it will only give me all the gardens from data, which is all the keys from dictionary. If I wanted to get all the keys and values, then he, I have to apply dot Adams function. Now, I hope you know what does this dot awesome function does. We have covered this in operations on dictionaries. But anyways, this dot items will give us all the keys and values of our dictionary inner tuple format. Here I can go like four, i comma j. These are just two variables and it can be renamed for i comma j in data. But in i comma and its price is. And here I'll just call G_E. And Nagaland is. Now here. It will give me all the kids from dictionary which is already gotten names. And this statement which is, and its price is a, followed by J, which is nothing but the prices. 41. Iterables: All right, so what are these iterables, whether these are the data types or data structures or more precisely, the RD objects now invite and everything is continued as an object. All the types of data which we have covered including tuple list in digital floor, literally everything is considered as an object. So these are the objects which allow us to loop over them. And among all the types of objects which we have covered in detail, float and Booleans are non iterables. Remaining of them are iterables. You've just great here nuns to which assign 1-2-3 as an, an integer, as a value for i in nums. Print i. If I run this, it will throw me a TypeError, which is int object is not terrible if I just make it as a string. And on this network specific, assign it to a Boolean, rerun this, it will throw me Aaron, bool object is not a terrible if I make it as a string and return these networks perfect. So whenever I say iterables, you just remember that I am basically referring to the objects which allow us to loop over them. And among all the objects which we have covered so far, tuple, list, set, dictionary, strings are iterables. 42. While Loops: Welcome back. So now we will cover while loops in Python. We uses while loops when we want to perform something for a number of times. Let's say if I just want to print this spam for three times, I can just copy this and paste it over here for three times and run this. It'll print out spam for three times. But what if I want to print spam for like 500 or 1000 times? Not doing this manually doesn't make sense, right? So we can automate this using while loops for that ya'll does include his print within the while loop. So when we define this While keyword, we declared that they did something needs to be done for a number of times. Ok, this here it is showing us a Varney if I just hover over it. Expression expected. So basically it is indicating that allright, I'll just print this as Pam for a number of times, but Kennedy's define the number like four, how many times I have to bring this spam. Here, we'll define the condition as. But in spam, as long as the value of count is less than ten. Now for this to run these, the first error which I will encounter is a name error. Name count is not defined. So here we'll set the value of count equal to 0. And every time we execute this code block, we will increment the value of count to count equals count plus one. Now for just run this and it will print out spam for n times. So what's going on here? Well, to understand this better, along with the spam, I'll print here count comma spam and run this. And now initially the value of count is 0. So it will check if 0 is less than ten, which is indeed a true condition. So it will execute this block of code. Now here we are incrementing the value of count to one, which is count equals two plus one, which is nothing but 0 is equals to 0 plus one. Now the value of count becomes one, is one less than ten, again, a true condition. So again, it will print the statement and increment the value of count to count is equal to n plus one, which is one is equals to one plus one. Now develop Khan becomes two, is two less than ten, again, a true condition. So again it will execute this block of CO two is equals to two plus one. Now the value of Khan becomes three, is three less than ten, again, Andrew condition. So it will continue doing this until the value of Khan becomes ten. Then it will check if n is less than ten. Now the condition becomes false, so it will exit the loop. This is that simple. If I just go ahead and print your count. Now can you guess what will be the value of count now? Will it be 0 or something else? Well, it will be ten, because every time we execute this code block, we increment the value of count by one. I hope you agree with this and I'll see you in the next tutorial. 43. Continue, break: Well, so now we will explore continue and break statements in the while loop. We use this continue and break statements. Whenever we want to skip something in the loop, are bred the loop based on some condition. Let's say he, I don't want this phi spam to be printed. I want to skip this, or instead, I want to print something else in the place of phi spam, then I can define it as if the value of count is equal to phi u. Then print, skip file. And again, continue the loop and run this. Now as soon, Well, here we got it. All right, so I have to print this after the conditional statements, which is if statement. And now fall on this. Now, as soon as the value of 5 billion account becomes phi u, it will print the statement and again continue the loop. If I wanted to break this loop somewhere around here, I can define it as if the value of count is equal to it. Then print brick the loop and break it. And run this. Now, as soon as the value of current becomes it, it will break the loop. 44. While vs if: Before moving further, let us quickly have a look at the difference between these while loops and conditional statements for that ya'll discrete and instrument. If the value of count is less than ten, then print spam and count is equal to plus one. And run this. One of the key difference between these conditional statements and while loop is here we execute this block of code only once you have the condition turns out to be true. But here we execute this block of code continuously as long as this condition holds true. 45. (IV)____Functions & Modules____: All right, so V How already covered three models, reduce the basic concepts, data structures and convert law. Now this model is going to be all about functions and modules. So let's jump in. 46. Functions: Hello and welcome back. Now here comes an important part of Python programming, which is functions, is functions are the lines of code which we tried to perform certain tasks. And they help us to reduce the size of a program and satisfy the concept of DRY, which is don't repeat yourself. When you want to perform same task at various parts of your program, then don't repeat yourself. Don't write the code again and again. Just create a function and write a code to perform that particular tasks. And wherever you wanted, you can just call that function, well, take it easily. I'll show you how does it actually works. But before that, do you really think that the concept of dysfunction is new to you? Well, then you are completely wrong because we are using this function since a long time. This print is a function, is istr is a function. This range is also a function and we have many built-in functions in Python. Anything which has a statement followed by the parenthesis is a function. So how can we get rid of our own functions? Well, to create a function, we first need to define this def statement and name of the function, followed by the parenthesis colon. And with respect to the indentation gap, a returned value. Now here I have created a function called say hello. If I just run this, here, we will not get any kind of output because when you create a function, you have to call it in order to execute it. Now here it will print out Hello. We have not post any kind of arguments to our function. I'll do one thing, others posture name as an argument. And here I'll create an ostream. And here I'll call this Nim and run this. Now it will throw me Piper. Sayhello function missing one required a positional argument. Nim. Here we have passed name as an argument. So when we call this function, we have to satisfy that argument. Sophia. Run this, not will print out Hello. Sophia. Let's say, I wanted to say hello to our another user, which is a audio, the neck and just call here, say hello and pass audio as a parameter. Well here we have not created any meaningful function. So in the next tutorial, we will just explore more about this. 47. More on Functions: Let's say if I want to print out the even numbers between a range of numbers, then here I can go like for i in range of one command, let's say 11. If I went divided by two and it's the reminder is 0, then print I. Refer just to run this. Now you will get the even numbers between one to n. Again, if I want to print out the even numbers between, let's say 20 to 30. Then I'm going to have to copy this and paste it over here and change these values to 20 comma 30. And again, if I want to print out the even numbers between 45 to 55, then I'm going to have to copy this, paste it or heal and change these values to 45 comma 55 or else, or else I can just quit or function or heal and I'll leave it as even underscore Nums to which all paths x comma y as two parameters. And here I'll just include this and tau code within this function. And he'll positive value of x and the value of y. And here I'll just call this function which is given nums. And pause your 20 comma three as parameters and run this. Now here we'll get the even numbers between 20 to 30. Again, even wanted to print out even numbers between, let's say 45 to 55, then I can just call this function and pass four to five comma 55 as arguments. But don't get confused between these parameters and arguments. In some Python books, the values which we pass within the parentheses when we create a function are referred as parameters and the values which you pass reading the patent is, is when we call that function, are referred as arguments. But it is remembered that, well, I say parameter or argument. I am basically referring to the values which we have to pass within the parentheses. Now if I just run this nodal, give me all the even numbers between 45 to 55. I hope now you know, why do we have this concept of functions and how they help us to reduce the size of our program. And they are very flexible like here we have the squirted dysfunction. And whenever we want to perform this task, we can just call this function. Again. Here we have this graded as symbol function, but V can perform many complex tasks using these functions. 48. Default Arguments: Welcome back. So now we will learn about default arguments in the functions. For that here I have created a function called Students to which I have passed two parameters, which is Nim and College. And its function just prints out name is from college student and pass your Austin comma GSS and run this. Now it will print out Austin is from Jesus. But if I remove this and try to run this, it will throw me a TypeError, student missing one required a positional argument, college ALU ending. I'll just sit here. The default value of this college as Bowtie and rerun this. Now it will check if there is any value passed to this college parameter. And if there is no value, then it will send its default value as a goatee. But if we add any value, that's a careless Android. Run this again, and that will distill Austin is from galas. I hope you are clear with this and I'll see you in the next tutorial. 49. Return: All right, so now here comes an important part of functions which is a return statement. All the functions which we have created in the last two tutorials, we have used printf statement, which is just prints out the result to get from this function on the output. But not every time we want to print out the result, right? We may want to perform some other operations on that result. Maybe, let's see, I'll just create a variable called answer, which I'll call this add function past 2535 as parameter print answer into 75. Run this. Now it will add 25 plus 35, which is 60627 divide. He will get the output as 4,500. But what if I had user? But instead mid and rerun this? It will throw me. I'll just call here add and plus 25 comma 25. Who didn't explicitly, why didn't this, we won't go to any kind of output you have, because here we are just returning a value in order to produce, we have to print this function. Print ad, ran this model predict 15. And another property of this router, easy for the Sprint, you start and print stop. And on this. Now here it'll only print start because this return statement, we're never gets any value of the return to the function. It will stop the execution of further programme and we will use this return statement more oftenly as compared to print statement. 50. Docstring: All right, some nominal explored his doctrine, which is the short form for documentation string. Suppose if you woke on some big projects, we have to create a lot of functions and sometimes you just forget that what does the function does? So it's a good practice to write a quick documentation about your functions. Let me show you an example here. If I call this range. Now here it will display us that this range function returns an object that produces a sequence of integers from start to stop. If a qualia myfunction, which is even nums, it display us nothing. So I'll do one thing. I'll just add a documentation string which is a docstring. To quit that, you just have to call you through single or double quotes. Hit enter. Now this is the future of Python, which is, it automatically generates these options for you. Here are white. This function gives even numbers between a range of numbers. Or parameter x is nothing but a start number. And its type is an integer. Y is nothing but a stop number and is also an integer. And here we are returning even numbers. And its type is also an integer. And if I call this even nums, now here it will display a documentation string and all the parameter it takes and what it returns. And it is really helpful just by looking at this doctrine, you can understand that what does the function does and what are the parameters which we have to pause and what it returns. I hope you are clear with this and I'll see you in the next tutorial. 51. Pass: And always remember that a function may return something or may not return something, but it cannot be empty. Like here, I have created a function which is completely MD. And if I try to run this, it will throw me at a. And if we don't have any kind of content to add to the function, then you can just call here pass keyboard. Now, it works. 52. Functions Recap: Well, so let's quickly recap these functions. These functions are the lines of code which we write to perform certain tasks. And most of the time, dysfunctions take some values as argument and it'll process that values and returns something out of it. And they are very helpful to group the syntaxes like here, we have used these for loops and if statements within this function and this piece of code will only be executed when we call this function. And they are really flexible like here. We can assign this function to a variable or use it in a data structure, or uses function within a function, very flexible. And whenever you create a function, usually writer a quick documentation about that function, which is a docstring. And it has several other advantages as well. I hope you are clear with these functions and I'll see you in the next one. 53. Global and local variables: Hello, given novel learn about global variables and local variables. These global variables are globally declared. Like if I create a variable called x to which I'll assign 15 as value. And here I'll quote a function, a variable called y two, which I'll assign 24 as value. Return. Why? I've a print here, x and y. And run this. Now it will throw me Nim error, which is y, is not defined because this y is a local variable and it can only be caught within this code block. And is y-variable is only created when we call this function. After the execution of this function, it will display this variable Y. So we cannot use this y outside of the function, but we can use this global variable, which is x anywhere we want in our program. Like If I add here Y plus X and print function. Run this. Not will add 15 plus 25. And Twitter was a 40. 54. len() min() max() round() abs(): Welcome back. So now we'll explore built-in functions in Python. Before that here I'll just print held function and run this. So what it does is it will give us a quick information about the version of Python which we have and where we can get it documentation. And here they have mentioned that what all steps which we can do with this help function, if it is, pass your symbols and rerun this. Now here it will give me the list of symbols which has meaning in Python. If a parcel, let's say keywords, run this part will give me all the special keywords which has meaning in Python. Some of them are already gone too, and some of them are still remaining. Which weasel cover? Now, coming back to the topic in this tutorial, we will exclude these built-in functions for that here I'll just quit or variable called XYZ ID two, which I'll assign a tuple, let say some random numbers. So I'm going to fire you and lets say 1 for you. And what not to. If I just print here of XYZ. By the way, when we assign multiple values to a variable that will be stored in a table. And on this, it will give me the length of 4-tuple logistics. All these functions can be applied on iterables. You already know what our iterables. If a call here min, it'll give me the minimum value of this tuple, which is when one phi same goes with max, it will give us a maximum value. And then we have this for that here I'll just assign a number to this exquisite. Let's keep it 50.048 rounds of XYZ it and rerun this. We do only give us 50 the movement and make it as 50.50. And didn't this voltage will give me 50, but if add here 50.51, it'll give me 51. So basically this ONE will give us a round figure of a number. And then we are ABS. If I just assigned here 23 and print abs absolute value of x, it will give me 23. If I make it as minus 23, it'll only give me 23. So abs will give us the absolute value of a number. That's it. And I'll see you in the next one. 55. zip() map() filter(): All right, so let's have a look at some other built-in functions in Python. So here we have list's containing fruits and prizes. And I wanted to create another list in which I want to store fruits along with the prices for that here I can just call zip function. That is, the function takes iterables as arguments, others passive fruits come up. Prizes. If we'll just print data and run this, here, will not get any kind of output because the type of this data variable is a zip. I'll do one thing. I'll just store them in a list. And now if I rerun this, it'll give me tuples containing fruits and prices. We have these elements in a pairs. So although one thing, I'll just store them in data, which is dictionary, read on this beautiful. So here we have dictionary containing fruits and prizes. So basically the zip function takes iterables as augments and it'll give us tuples containing elements from these iterables. And then we have map function. Let's see here we have a distances is stored in kilometers to command three comma and 0.23 comma for you. And we want to create another list in which we want to store these distances in miles. Of course we can do this using for loops like full Adams in kilometers, miles dot append items into 0.6 to 13. Or we can do the same task using map function. So he, I'll just call list, within which I'll call this map function. Now this map function takes two arguments, which is a function and an iterable. So here I'll just create a function called a KM two miles, which is a Kilometers to Miles. I'll pass data as parameter. And here I'll just return data into 0.6 to 103. And here I'll just pause KM two miles comma k m. If we're just print miles here and run this now here to give me a list containing these numbers in miles. So basically this map function takes two arguments, which is a function and an iterable. And we'll apply that function on all the elements in a data table. And then we have filter. So as an EMS is using this filter function, we can filter out the values. Let's see here we have a list of nums containing 136978101213. And we want to create another list in which you want to store the number which are divisible by three. We can do this using filter function. I'll just call this filter function within the list. So this filter function takes two arguments, which is a function and an iterable. So he others create a function called a DIV by three, in which I'll pass nums as parameter. And here I'll just greater conditional statement, which is if nums when divided by three and is reminder is 0, then return true. Else return false. And here I'll just pause dV by three comma nums and print divisible by three. And run this. I'll just comment it out. So basically this filter function takes two arguments, which is a function and any terrible. And it will apply that function on all the elements of D. It able, based on that, it will filter out the values. So these are some basic built-in functions and they are really helpful. And they're also referred as one liners. As we can perform many tasks in one lines on value, and that's it. And I'll see you in the next one. 56. Methods: All right, so now we learn about methods in Python does methods and nothing but the functions, but they can only be called on certain objects. Let me create a variable called XYZ ID two, which I'll assign a string called Hello. If I just print here X, Y, Zed dot upper and run this. Now this daughter PR is nothing but a metadata. It can only be called on strings. If I tried to access this dot upper, basically, it will throw me error. I cannot even call this upper directly. We have to call this a string itself. If I just print your d of x, y, z, which is nothing but a string, and run this. Now all these operations are nothing but the methods. These methods can only be called on certain objects. If I create a list. Now here I can call dot sort, dot append. And all the operations on the list are nothing but the methods. We will learn more about methods in object oriented programming. 57. Modules: Now here comes an exciting part of Python modules. These modules are the programs with someone else have written, but we can use them to do use a module. We first have to import it, and we can import it by using input keyword followed by the name of the module. Let, if I want to get the square root of number for that here, I'll just import Matt and print Matt dot SQRT, which is square root and basmati value. And run this will give me the square root of 25. If we wanted to get the factorial of a number, then I can just call here dot factorial and pass or let's say seven. And run this. Now here it will give me factorial of seven. Basically these modals are nothing but a set of instructions of functions. If we just control, click on it, it will take you to its score. Well, hearing should not change anything. Let's, if we want to get the value of this pi, then here I can just call math.pi by and Randy's or Hayden give me this value. Now here we have multiple ways in which we can import a module. We shall see them in the next tutorial. 58. Importing Module: Now we will cover different ways of importing a module. Let's say you just want SQRT function from the math. Then here you can go like Fermat inputs, SQRT, print. Now instead of calling this Math.sqrt will have to call you directly SQRT because here we are just importing the square root function 25s parameter on this. Now if you see that it is SQRT is bit confusing. So is there any way in which we can change the name of this function? Well, we can do that as we'll look Olivia as keyword and giving it a desire to name square underscore wrote on this. Now it will throw me Nim era, which is SQRT is not defined because here we are importing this SQR to function as a square roots. So here we need to call square root. And if we want to import another function, then you can just add a comma and define the name of a function and find the name of a function. And if you want to import all the functions from this map loaded, and then here you can go like from math import asterix. Now you are able to use any function from this mock module like SQRT, sine theta factorial log, literally anything from this RAT model. 59. Create and Import: All right, so now we will look at how we can create an import, our own models. But before that, remember that or interpreter will only search for the modules in some specified directories, will just import here and print, which is System.out, pot and run this. So these are the data fields in which our interpreter will search for the models. Now this is not current working directory, which is all hill. Now here I can create my module and the interpreter will easily get that. I'll just create a python file here. And when you're creating your own model, you need to keep in mind about two stuffs, which is your model should have extension and you cannot define name of Memorial which is already present like Matt. Instead, you can go like my underscore, Matt. Yeah, I'll just create a function, let's say ad, which takes two parameters, x comma y, and it returns x plus y. Now I'll just copy this. Paste it here, here. And here. This is going to be deaf, let's say. So subtraction x minus y, multiplication X into Y, and division x by y. Now here I can just input my mat and print ad and plus 25 comma 35 as parameters. And run this meog which my red dot subtract. Well, if I warned you all of these functions at once, then I can go like from Ahmed import asterix. Now I can use any of the function from this mimed directly, like this, add, subtract, multiplication or division. I hope you agree with this and I'll see you in the next tutorial. 60. Random: All right, so let's have a look at building models in Python. In this tutorial, we'll exploded at random model. Using this random module, we can generate some random numbers, R, choose something randomly and so on. Let me just import random here. If I just print and Dato rand int and possibly a one Gamal on say, 15 and run this. So what it does is every time I run this, it will give me a random value between one to 15. And then we have random dot choice. Here I'll just pause a string called, let's say hello world. Now these are a number of choice will randomly choose o element from this string, I just create a list in which I'll store, let's say spam 58, sovereignty 9.352 to some random numbers. If I just called you random.choice of x. And on this matter, randomly choose an element from the list. And then we have a Random Dot. Shuffle. And here I'll pass x and print x. And on this, on these randomly shuffled will randomly shuffle our list. So these are some basic tasks which we can do with the random module. 61. Time and datetime: Well, so let's have a look at some other building modules in Python, which is datum and time. If I just bring to your datetime, dot datetime. But today and run this. Now here it will just let me current date and time. There's domino also perform the same task. If I call that m dot, dot, dot. Today, it will give me the current date and then we have time. I'll just call your Time.deltaTime, ASC time and run this. Now here it will give me the current day, month, date, time, and you're now these models will have a lot of functionalities which you don't actually have to worry about because there are only few functionalities which we will encounter leg if you consider this time module, it has got a lot of functionalities. But at the end of the day, it's job is to only work with the time littered stuffs. And another functionality of this time is if I just call here, I'm dot sleep. And given you to provide the number of seconds, I'll give it as two. And here I'll just print hello and run this. So what it does is it will hold the execution of our program for two seconds. If a call your time dot sleep. Again, I'll add 2 second and print world. And run this. Now here it will hold for two seconds and then print hello. And again those against and after that it will print world. Well, so these are some building models which are really helpful to perform day-to-day tasks. And these are not the only models. We have several other models as well. If you want to learn more about them, you can just Google out building models in Python. 62. Python Standard Library: Well, if I just invert your random and run these networks perfect. If another model called a, let's say TensorFlow and rerun this. Now it'll throw me no model around because it's random is a part of python standard library. This is the Python standard library and basically it's a collection of scripts and modules. And is random is a part of python standard library. It when this math is a part of python standard library, you when this datetime which we have covered, all of these are a part of python standard library, so we don't have to install them manually. But since this tentative loser third-party module, and we're going to work with a lot of third party modules to use any third-party module, we first have to install it in our computer. And we can install these third party modules using Python package managers. And among all DIP package managers, PEPs widely used. So to learn more or what people into how to install these third party modules using Pip. You can refer my last class, which is on Python environment set up. 63. (V)____File & Exception Handling___: Hello everyone, welcome back. Now, I hope you have gone through the cuisine functions and modules. Now, in this module we are going to learn about file handling and exception handling. 64. Reading a file: What is up, everybody, welcome back. So now we'll have a look at file handling in Brighton. In this tutorial, we will learn about how we can redefine for that. Here are the squid. A new file. And name of the file will be 5w1 dot TXT. It ended up in which our writer, let's say python is fun. Not to read this file others greatly a variable called file two, which I'll call this open function. Now here we need to define the path followed by the name and funded by the extension. Since I have graded this file within the same directory, I'll just define its name, which is file.txt. Now here we need to define the operation since I'm just reading it. So alcohol here, r is equal to phi dot read. Now if I just print read and run this, now here we will get the content of our dxdy. 65. Write and append: Well, so in the last tutorial, we have looked at how we can read a file. In this tutorial, we will learn about how we can create a file and append the data into that file. For that here I'll just create a variable called, let's say file to do which I'll call this open. And I'll define the name of the file as a file 2.txt. And the mood as w, which is right. Create two is equal to file two dots. Right? Now here I'll just add some content into the file, which is going to be hello world. And our 3D file 2.txt run this and we won't get any kind of output here. But here you have successfully created a file 2.txt. In order to read this file, we first have to close it. For the IT, I'll just call this file two dot close. And on this matter will display the content of my finally, not to append any data into the file visited due to find you the mood as a we just append. And R1 is. Now one of the key difference between this append and right is just Eusebio, the mode as right. And, and some random data and a oneness. My dual areas all the previous data. It will replace all the previous data with this one. If I use here the mood as append and add some random data and a read on this metal not be stub the data which is already present in a file. Instead, it will add this at the end. Now you might ask me something like, can we create a file using the append mode? Well, we can do that as well for that he others good file tree to which I will call this open name of the file will be fine. Three dot TXT. And I'll define the mood as append. Create three is equal to file three dot, right? Fine, three dot, close. And here I'll just read file 2.txt and run this. Now here we have created this file 2.txt, and this is our content of the file tree. Well, I hope you are clear with all these concepts and I'll see you in the next tutorial. 66. With: Well, so let's have a look at how we can read files using width keyword for that here I'll just define this width and call open function. And name of the file. More will be read. And I'll open this file as a file. Again, this is just a variable and it can be renamed. R3 is equal to file dot. Read, then print file, sorry, RED. Now I'll just commit it out and run this. Now this piece of code perform the same task as the code which we have written here. 67. Type of Errors: Well, so it's been a long time since you are learning these syntaxes. Now let's explore the other side of programming which is arose in Python, or more precisely, in most of the programming languages, we will encounter a lot of arrows, but they can be divided into these three main arrow, which is a syntax error, logical and runtime error. We get this index error completely from the mistakes made by the developers are programmers. Let me show you an example here. If I just print spam and forget to close this parenthesis brighter on this novel to me, a syntax error. If the closest pattern this is under, remove the code and rerun this. Now also to throw me a syntax error. Now this syntax error can be easily traced and salt like he, I can just head over to the line number from which I am getting the error and lookup for all the mistakes and solve them. We get a syntax error. When the compiler cannot compile our program, where the compiler fields to convert our program into the machine and the standard, We'll now this logical errors are not actually arrows. You can refer them as books maybe, because here we will execute our program without any error successfully. But the problem is we will not get the desired output. Let me show an example here. For this sprint, 15 plus five divided by two. Now the answer which we are expecting is ten, but if I run this, it will be 17.5. Of course this is due to operator precedence in which it will go for division first and then it will go for addition. But this can be a great example of logical error and they are really dangerous. Let's say you have created an application which calculates something and you have a logical error in your application. Now it will be messed up because you don't have any error. But along with that, it gives you undesired outputs. And then we have runtime error, novae and gone to this runtime error only add some situation are at some part of our program. Let's approach it practically. For that few others, print, start, and stop. And here I'll just take it as an input from the user. Int input. Enter your age. Now I'll create a conditional statement which is if it is greater than or equal to 20, then print you are allowed. Or else just prints you are not allowed. And now if I run this and add here, let's say it in and hit enter. And now it works perfect. Rule on this. 25. It ends up. Now also it works perfect. But if I add here and hit enter, now it'll throw us at r. So here we get this error only at some critical situations. But the problem with this is when it throws us any error, it will stop the execution of photo program. That is the reason we have not Gordy's stop here. So we will learn more about handling these kinds of critical situations in the next tutorial. 68. Try & except: Relative to here we have a program which just takes as an input from the user. And if the age is greater than or equal to 20, then it will print out you are allowed. And if not, then it'll print out you're not allowed. Output of this program is a dependent on input of the user. We'll just run this and add here 25, hit Enter. It will explode. If ITO 14, it Enda. And also it works perfect. But what if I add any extra characters such as x could end up muddled through me value error. And along with that, it will stop the execution of the program. To avoid this, we will just include this entire code within the try. And except are will be print, invalid. Input. And a read on this. Now for adding any extra character, it end up. Now here we will not get any kind of error. So what it does is firstly, this try clause will be executed, which is this block of code. And if you have any kind of error in this block, then it will stop the execution right there and it will move to the except block. And if you don't have any kind of arrows in this block, then it will not execute this except block. It will directly move to the print statement. If I just run this. And add here, let's say 25 hit enter. That will directly move to D print statement, skipping this except block. 69. Exception Handling: Well, let's take these exceptions for the, for that here on this grid. A variable called x to which I'll assign it has value and y two, which I'll assign to as value. Print x by y and run this. Well lord works perfect. But what if I add u 0 and tried to run this through means 0 division error, which is division by 0 is not possible. So here we'll just include his entire code within try. And acceptable B, a 0 division error. And we will accept it as E. Again, this is just a variable, can be renamed print E. So what it does is, instead of throwing us that ugly error, it will display a message. It will just make it as a string. And we run this. Again, it will throw us a type or o. So here we will accept another error which is a type around as e. Well, this time I will accept it as x, print x, and run this. Well here it will display this message. I'll just input here, Matt. And here I'll just call print Match dot SQRT 25. And run this. Now it works perfect, but what if I add here minus10 frail and try to run this? Metal threw me a value error. So instead of handling these arrows individually, we can just call here except an exception. Notice exception. Use a jumble like it can handle literally any kind of atom, whether it might be a 0 division error or a value error, type or are important or name error, whatever as E and print E. And run this. Now here it will handle value at our print x by y. And run is. Now here it will handle a type, oh, I'll just make it as a 0 and run this model handle, the 0 division error. There is nothing in this exception handling. It's quite similar to try and go for this and if it doesn't work out, then go for this. I hope you are clear with all these concepts and I'll see you in the next one. 70. Finally: Well, so now that we have covered this far and accept clauses, let's have a look at this finally. So he, I'll just call this finally in which I'll just print over and run this. And that or number. I'll just type your 15 hit enter. And it will execute this block of code and it will print over. If I rerun this, it Adi a 0 could end up. Now here it'll handled 0 division error. And along with that it will print overall. If I run this and add here, any textual character could end up. Now here it will handle value arrow, and it'll print only indigenous accepted. And along with that, it'll print out over so vividly when we use. Finally, no matter whether we have an adder or we don't have any EDR, this block of code will always be executed. I hope you agree with this. Now why do we have this concept of exception handling? Well, one of the best total bondage of these exception handling USA awaiting the crushing of soft divs or applications. Of course here we just have a simple program, but the same logic can be used in large-scale applications as well. I'm barely adapt it and I'll see you in the next one. 71. Errors in Python: Hello everybody. Welcome back. So now we'll cover errors in Brighton. Here. I have mentioned few of them, but these are not the only Aras which we will encounter. There are a lot of arrows and several third-party models have their own. As bot dealers, some basic errors which we will encounter oftenly. And I'm damn show if you're following along with me, then you might have came across literally all of these arrows. And I have included this tutorial so that whenever you encounter any of these, you should understand why you are getting it and how it can be solved. So firstly, here we have a syntax analyzer, which is also referred as parsing because we get this index when we fail to pass our program into machine understandable binary. Just put in here 25 and flow forgot to close this parent is and try to run this. It will throw me a syntax error. The syntax that it can be easily traced and salt. And then we have modeled arrow. We get this modal error when we try to use a model which is not already present in our computer. If I just import here TensorFlow and tried to run this, not to throw me a module error because this tensor flow is not installed in my computer. And then we have indentation error. If I just create a function called index to reach, I'll print hello. And pride on this neutral mean indentation error. We get this indentation error when we use an inappropriate indentation. And then we have Nim error. If it just print here. C. And writer on this, not to throw me a name error. We get this name error when we try to access something which is not already defined. And then we have i beta for that here I'll just import Matt Math.sqrt, square root alpha Q. Now for try to run this, it will throw me, I better. We get this error when we use an inappropriate data type. And then we have a value error. If I just print here, Matt dot SQRT, and here I'll pass a correct datatype, but an incorrect value and try to run this, it will give me value error. We get this when we use the correct data type, but an incorrect value. So these are some basic arrows which you may encounter. A MEA, that's it, and I'll see you in the next tutorial. 72. Raising Exception: All right, so since we are working with these exceptions, let's have a look at how we can write our own exception for that here I'll just create a function called add two, which I'll pass two parameters, which is x comma y. And this function just returns x plus y. If I just print this function and pass 2525 as argument, and run these notebooks. Perfect, but what if I make it as a string? And on this note will be messed up, it will display as a 25250. So here we will create something like if the data type of this argument is a string, then we will rise an exception for that he others quit. And conditional statement, which is if the type of x is equal to string, are the type of y is equal to a string. If any of this is a string, then he will rise. Or type or 01 this. But we'll throw a type error. We can even display the message in this era only in is accepted. And run this. Now here we'll get that message. And if you pass your indigenous three comma six, no, it will walk off it. 73. (VI)_____Additional Concepts_____: All right, so whatever we have covered so far is just enough for you to get started with Python. Now what we are going to go or additional contents, we don't use all of these contexts on regular basis, but it's good to know that they exist. So let's get started. 74. List Comprehensions: Welcome back. So now we will look at list comprehensions in Python. Let's if I wanted to create a list of all the odd numbers between one to 20, of course I can just type it manually like 13 for you and go up to 19 ADL. Second is square root of four loop here, which is a for i in range of one comma. Ready? If I when divided by two and is reminded is not equal to 0. Then my list dot append i. And here if I print my list and run this, it will give me a list of all the odd numbers between one to 20. Let's look at how we can do this using a list comprehension. For that, Yael does define the expedition as an I for i in range of one comma 20. I'll just comment it out and print my list, but will give me the list of all the numbers between 12. Ready? Let's apply this condition here. If I, when divided by two, remainder is not equal to 0. My vote on this, it will give me a list of all the odd numbers between one to 20. Now this list comprehensions comes in handy when we want to generate a new list based on a list which we already have. Now here I have a list of costs. I'll just copy this and paste it over here. Let's see if I wanted to create another list called my underscore. God's not in this list. I want to store the name of the cars which has alphabet in them. Firstly, let's have a look at how we can do this using quadruples for items in cars. If Alphabet in atoms, then Michael's dot append items. Now here, if I print my car and run this model, give me a list of all the cost which has alphabet in them. Now we'll perform the same task using list comprehension, I4, I in cars, if it in IE. And now let us commit it out. Later on this. Now here do you give me the list of gardens which has alphabet in them? If I replaces a return E and rerun this node will give me all the list of condoms which has alphabet 0s in them is list comprehensions are really confusing. This look at this syntax, I4, in God's if e in i, this is super confusing. But why do we have this concept of, Let's comprehension when we can perform the same task using for loops rather, this list comprehension is a little bit fostered in this follow-up. Time may not matter to you right now because here we just have a couple of elements in a list. So in both of these scenarios, it will execute the program within fraction of seconds. What if we have like hundreds and thousands of data? That is when the time does matter. So you have to choose an option which takes less time to execute. Now remain not use this list comprehension and even in these cities, but it's good to know that they exist. So that's it. And I'll see you in the next tutorial. 75. Lambda function: All right, so now we will cover lambda functions in Brighton is lambda functions, Aldi, anonymous functions, and we just wait here a function called add. Now this function takes x comma y as two parameters, and it just returns explicit y. Now this is how we create functions in Python. Traditionally, we can do the same using lambda functions. For that here are just greater variable called zed two, which I'll call these lambda x comma y, x plus y. To create a lambda function, we have to first define this lambda keyword followed by the arguments department is which we want to pass into our function and the expression. Now here, if I just print zed and pause 25 as value to the X, value to y. And on this little print out 50, this piece of code performs the same job as the one which we have heal, acquit another function called let's say, say hello, a Lambda function. And here I'll just pass as a parameter and f string. Hello, Nim. And here I'll just call this sayHello function and postural Bob. And blend this. Now it will print out Hello, Bob reuses lambda function when we want to create a function or we need a function for a shorter period of time. And more oftenly, this lambda function is passed as an argument to the main function. I'll just create a function called a, let's say words. Now this function takes text as a parameter and it just loops over these texts. For I indexed print I. Here, I'll just call this holes and pass your Python is fun. And if I run this, now here it will print dot Python is fun in a sequence, it will go like PYT H0, but we don't want this. We want something like Python is and fun. So here liquid, a lambda function which is a split underscore, STR splits string to which we will assign this lambda. Txt is our parameter. And here we'll just written text dot split. We will split over text based on the specific. Let me just get rid of all these extra code which we have here. And here I'll just call this split STR and pause this. Python is fun as a, I'm going to do over lambda function. Now photon does not separate out. Python is fun. So what is going on here? Well, this is our main function which is volts and is worth takes text as a parameter. And it'll loop all these texts, which is a four I index print i. And here we have our lambda function which is split STR. Now this lambda function also takes text as a parameter and it'll split our text based on the spaces. So instead of passing this biotin is phone directly to our main function. We are passing this Python is 0.2 over lambda function which is a split STR. And here we are passing this lambda function which is split SDR to our main function which is wars. Now this is a little bit tricky concepts, so we'll just go ahead and layer on it. 76. Zen of python & pep 8: All right, so what is the Zen of Python? Well, it's a set of guiding principles to the programming best way possible. If you just import here, this and this, you can have a look at all the principles. Now despair part is all about the best practices to write Python programs. If it's Google it out, you can find its documentation. And if we don't actually have the time to go through the entire documentation, you can just go for an article from geeks four gigs, which is coding style guide in Python. It's just three to four minutes of read. So just give it a try. 77. Project: Hello everyone. So you've got a project here which is a heat. You have to create this my math program or calculated. You can see now here we just have a couple of functions in this program, which is an addition, subtraction, multiplication, and division. But as you try to add as many functionalities as you can, like, you can define the value of pi out of you can create a function to calculate the factorial of a number or square root of a number. And you can just Google the formula to calculate something and tried to implement that formula in your functions. And your function should always have the documentation. This part is optional, but you should write a short documentation about your functions. Now take it as a project or a challenge, whatever. But the one who will have a lot of functionalities into their programs will be a clear winner in this. Now for more information on how to submit your project, you can just refer projects section of this class. 78. What's next ?: Hello everybody. Congratulations for making it to the end. Now you are among those top 5% people who start something and actually finish it. So here we have covered a lot of stuff. So what's next? Well, in the next class, we are going to use whatever we have learned in this class to build something meaningful. So make sure you follow me so that whenever I upload that class or any other glass, you get notified. And by the time you're watching this, it might have already been uploaded, so just check it. And daggers so much for your valuable time. And I'll see you in the next class.