1.4 Python coding exercise | Python Full course 2024 #learnpythonin2024 #mlwithakansha

Akansha Yadav shows how to assign values to variables and use them with numbers and strings. Learn arithmetic operations like addition and division, string concatenation, and how the multiplication operator works differently on text versus numbers.
Chapters
Ladies and gentlemen, going to create another file which is working with, working with variables.ipynb. So in the last video you might have seen that we've discussed about the variables and the data types. There are two types of data type which we have discussed. One is the numeric data type and second is the string data type. So we will explore Python more with the help of normal print statement, variables, and the data types. So suppose I have a variable a in which I have stored 5. Then I have variable b in which I am storing 2. Now I'm going to operate something, so I'm saying a 2. It gives me the output. Here I am using a variable and the data type, and in between I am writing an operator which is addition operator that we usually use in our normal maths calculation. Another, let's suppose b 3 multiply a plus b. So it will operate. I'm giving it a certain equation, it's working for me as a calculator. So this is how you can work with the data types and variables. You can use anything like division if you want. Another, let's suppose an example is first name is equal to— I'm writing, let's suppose, Roy. Last name, underscore, last underscore name is equal to that. So I have two variables, first name and the last name. Same formula goes for the strings as well. First_name plus last_name. Here we have L capital, so we have to write it. So this is how it works. Suppose I want space in between them, so what I can do is I'm going to say take same command and after plus I will write quotations, close the quotations, then plus. In this quotation I'm not going to write any word, I will just add one tab space. If I will run it, it will add a space for me. If you are using normal Python file, don't forget to write print in front of all these commands, like this: print first underscore name, it will print name for us. print_last_name multiply by 10. I want last name 10 times, so I'm writing multiplication 10. So string will be repeated, like in, in strings, if you are going to write any operator, it will repeat that particular thing. Suppose I'm writing print 1 in the quotations, I'm writing multiply 10, so it will print 1 10 times. It's not going to multiply it. But in case you wanted to multiply it, you won't be writing it as a string, you will just write it as a normal number. And then if you write it— wait, write 10, it will do multiplication for you. But here I am using quotation, which means it is a string, so it will repeat that particular thing. So I want you to explore Python with the help of normal print statement, variables, and data types. It will enhance your basic skills and will help you learn and grasp the concepts easier.










