Podcast Lookup

_3 Python Tutorial for Beginners _ Getting Started with Python

Python To You

  • October 8, 2026
  • 15 min
Episode page

About this episode

No description.

Transcript

From the publisher

This transcript comes from the podcast’s own feed, shown as the publisher wrote it.

_3 Python Tutorial for Beginners _ Getting Started with Python

00:00—
  1. Speaker 1

    Welcome back Aliens, my name is Dhavan Reddy and let's continue with this series of Python. Now, we have talked about what is Python and we have talked about how to install Python on your machine. It's time to start with the actual stuff, right? And we are waiting for this. Now, the step one would be, of course, you need to open your IDE. Now, if you remember, in the installation, we have installed two softwares. One is the interpreter and second is your PyCharm. But will not be using PyCharm in this tutorial. We'll start with the basics so that you will be having that hands on experience on IDLE as well. So let's try it out. So what I will do is I will open my IDLE and in that. So this is your prompt. OK, so this is your prompt. This is where you will type your code now. Before going for the actual code, we have a question here. Why do we code and why do we write a code? Now think about this. We are living in a world where everything is done with the help of computers, right? Example, if you want to send an SMS, if you want to send an email, you don't have to do that. Your computer will do it for you if you instruct it. example nowadays we have this amazing thing you know we have Siri on iPhone and then we have Google Assistant on Android phones you know you can ask them to do things for you example you want to set an alarm you can you know they will do it for you but then how they understand what you want to say so you need to talk to a computer and if you want to talk to your computer you need to understand their language right and the language which computer understands is binary code which is zeros and ones Now that means if you want to talk to computer you need to talk to them in terms of zeros and ones. Now it is not actually possible right of course. So what you have to do is you need to use a language which both will understand. So we all know English language but computer will not understand plain English right because we have some grammatical stuff here. so what we have done is we have created programming languages now those are not actually example we have high level languages now those are not exactly a binary code and they are not even exactly same as english they are somewhat you know they have their own protocols they have their own grammar which we use so when i say english so we have level one english then we have level two which is programming language and then we have level three which is your which is your binary format So you understand English. So what you will do is you will learn a programming language, let's say Python in this case, and then you will write a Python code which will get converted into binary format, which a computer will understand. So if you say, hey, computer, do something for me. So let's go with a very simple stuff here. Let's say I want to add two numbers. So you will say, hey, computer, two plus three, a computer will say, OK, five. But then how do you talk to a computer in this case? So we are using Python and then we have an interpreter. In fact, in Python, as we discussed, it's one of the easiest language, right? So what I will do is I will say two plus three. This is the simplest task you can do on Python. So I will say 2 plus 3. It works. You can see we got 5. Yes, this is working. What else? What about subtraction? You know, we love mathematics, right? So let's apply all the arithmetic operations here. Let's try 9 minus 8. It should be 1, right? We got 1. So yes, subtraction also works. Okay, what else we can use? Can we use multiplication? Let's try 4 into 6. It should be 24. Yeah, that's right. We got the answer. So yes, addition, subtraction, multiplication works. What about division? Okay, let's try. So when I say division, it should be 8 divided by 4. And I'm expecting the answer to be 2. Yeah, it's 2. But hold on. There is a difference here. You can see when we say 2 plus 3, we got 5. 9 minus 8, which is 1. So... When you subtract two numbers, we are getting that number, right? And specifically, these are integer numbers, right? We all use integers. But then when you divide a number, it is giving you a point value. Now, this point value is also called as float numbers. So, we have integers and then we have float. Now, float stands for floating point representation. Okay. But why it is 2.0? Because when you divide numbers, you might get point values. For example, when you say 5 divided by 2, you will get 2.5. Example, let's try it out. So if I say 5 divided by 2, you got 2.5 and you want that 0.5 value, right? That's why it converts your number or your output into a float value because they want to give you the exact value. But what if you don't want it? What if you want only the quotient part? Example, when I say 5 divided by 2, you want only 2. You don't want 0.5 value. So we can do that. You know, if you want only integer output, so we don't want float now, we want only integer, you can do that. You can say 5. Instead of giving 1 slash, you have to give 2 slash. Now, this is also called as integer division or it is also called as flow division. So, when I say run this code, you got 2. So, this is working, yeah. Okay, what else we can do here? Can I do, you know, combination of this arithmetic operation? Example, let's say 8 plus 9. Yeah, and then subtract it by, let's say 10. Is it possible? Let's try it. So it works, you know, so you can have multiple operations, right? But then we have to follow grammar, right? If you say 8 plus 9 and then subtract, you forgot to type 10 there. It will give you an error, which is invalid syntax. And that's why you need to follow the grammar as well. So when you learn a language, you need to follow grammars in the same way. In programming as well, you have to follow grammar. Can I use those brackets stuff which we used to use in mathematics? Yes, we can. For example, let's say we have 8 and then I'm adding that value. But then I also have a value which is 2 into 3. Now, which one will be done first? Of course, the multiplication part, right? But then what if you want to do it? Oh, let's try this first. So you can see we got 14, which is 8 plus 6. But what if I want to say 8 plus 2, which is 10 and then 3. So in that case, you need to use brackets, right? If you remember the board mass rule, so I would say 8 plus 2, which is in the brackets and then into 3. So you can see we got 30. So yes, this also works. So when you multiply, so if you give a bracket, it will be solved first. Okay, this is cool, right? Now what else we can do here? What if I want to find a power of or we can say exponent, you know, so let's say if you have 2 raise to 3 or 5 raise to 6. How can I do that? So I will say 2. I want to find cube of 2. So in that case, I can say 2 into 2 into 2. We can do that. But then what if you have 2 raise to 10? You cannot simply type 2 into 2 into 2 into 10 times. Because this will give the right answer. It is 8. Otherwise, you can say 2. You can give double star and 3. So double star or double hashtag symbol simply means power off. So when you say 2 raise to 3, so this is 2, hashtag, hashtag, 3. And you can see we got 8. so that's how you have to find you have to do this all this operation so now we know how to add two numbers how to subtract two numbers and then multiplication division a flow division but what else we can do here in fact you know we can we can also do modulus now what is modulus here let's say i'm dividing i'm dividing two numbers which is 10 uh divide by 2 or maybe 3 in this case Now it's a 10 divided by 3. It will give you 3, right? But then we also have a remainder here, which is 1. So when I say 10 divided by, which is the integer division, you've got 3. That's right. But what if I want the remainder part of it? So I would say 10. And we have to use a special symbol here, which is modulus. And we'll say 3. You can see we got 1, which is a remainder. So when you say 10 mod 3, you will get a remainder, which is 1. Okay, this works. Yay! Now, you know all the operators, right? Now what else we can do here? Now till this point, we have discussed about two types. One is the integer type, which we have done here. And then we have talked about float. What other types we can have here? Can we have string? You know what a string means? It's a combination of characters. Example, my name, Naveen, is a string. Python is a string. Camera is a string. YouTube is a string, right? So we have to use, can we use string here? We can. Let's try. So what I will do is, whenever you want to use string, you should always use single quote or double quote. So let's try. So I will use my name first. So I will say single quote and Naveen. So we have to use a quote here. So you have to say Naveen. And enter, you can see we got the same value. We got Naveen. Now there's another way of printing these values. You can also print by providing some functions. Oh, that's a new word now. Note of functions in Python language. We have certain functions which we can use and one of the function is print. Now what print means or what function means is it is a set of tasks which you will be doing. For example, in print, which is inbuilt, it has certain tasks which it will do. You just need to call it. Can we define our own functions? Yes, we can. So print is an inbuilt function. We can define our own functions as well. So you can do all these operations in one function. You can do that. But we'll see that later. How do we define our own function? But time being, let's use print. And when you have a print, you normally give this round back edge to pass any parameter. Let's say if you want to pass something to the function, you can do it here. In this case, I want to pass my own name. So I'm saying print Navin. So you can see it works. We got Naveen as a value there. Okay, that works. Now, if you see the difference between Naveen, the earlier command here, if you compare this one with this one, see the output. So in the earlier one, the single code is getting printed as well. But in the second one, it is only printing my name. And that looks beautiful, you know. Okay, let's try to print something else. I will say print. And here I want to print, let's say, Naveen's laptop. So Naveen's laptop. It should print Naveen's laptop, right? When I say enter, oh, we got an error. that's weird now what went wrong here now if you observe here we have single code as a starting one and then we also have a single code here so that means that is one string and then this thing which is s laptop it is not as a part of that single code that's where that's where the problem starts so you cannot simply have single code anywhere right so how do you solve this problem to solve this problem we have two solutions the first one is you instead of using single code you use double quotes. Example, you can say print and in double quotes, you can say Naveen's laptop. Now, since the starting and ending is done with the help of double quotes, you don't have to worry about the single quote in between. And if I say enter and you can see we got the output as Naveen's laptop. Now what else what are the commands we can do so this this thing works here I will have to think about this what if I want to print double quotes in a statement let's say we have print inside double quotes I am saying Navin laptop but I want to print laptop in double quotes can I do that example the output should be Navin and laptop but then the laptop should be in double quotes we cannot do that because you know the first double quotes and second double quotes will be getting ended here so this this is my first string What about this laptop? Now, in that case, we will be using single code. So single code and end with single code. So you have to make sure the string part should be different from the part which are inside. So if inside we have double quotes, then outside we should be using single code. Right. That makes sense. Right. So you can see we got the output. But here's a trick. What if I have both in the string? Example, let's say we have print. I want to say Naveen's laptop. And you can see we have both now. We have double quotes and we have single quote both. That's where the problem starts. So what you will do now, because if I say enter, you got invalid syntax. In that case, we will say single quote navines and then in double quotes, we'll say laptop. The issue is with this S, right? This S is coming before a single quote. So we have to tell your Python, hey, Python, can you just skip that special meaning of that single quote? And the way you do that is by giving a slash. So when you say backslash, it will make sure that you it will ignore the special meaning of that single code. So when I say enter, it works, you know. So these are the basic fundamentals which we're talking about. Now let's do some fun here. So again, we'll continue with the print later, but we have some fun thing here. What if you want to print Navin two times or you want to print Navin three times? Can I do that? Of course, we can write. You can type Naveen and then Naveen again. Or you can also use a plus character here. So if you want to concatenate two strings, so we have two strings here, right? We have Naveen and we have Naveen. So when I say enter, so you can see we have Naveen and Naveen. So we are combining it. What if I want to print Naveen three times or 10 times? In that case, you know, you can play with the numbers as well. So you can say 10 into in single code. You can say Naveen and say enter. You can see we got Naveen 10 times. Yeah. So Python is fun, actually, you know, you can you can play with it. You can do some experiment. That's amazing. What if I want to print this one? You tell me. OK, you try to guess it. Will it work or not? Just pause the video, guess it. Let me know in the comment section if it will work or not. And then we can continue. What I will do is I will print something. I would say C colon slash. I have a direct because docs slash Naveen. So pause the video, think about it and let's see what output you are giving. Let's try. Answer enter. Oh, this is weird. We were expecting it will print C colon docs slash Naveen. But unfortunately it is giving a new line and then Avin. What's wrong? Now, slash n has a special meaning in Python. What is that special meaning? And the meaning is it means new line. So slash n means new line. And that's what is happening here. It prints. It is printing C colon slash docs. And then it comes to a new line because of slash n. It is saying a win. OK, what I do is I want to print it. I want to print it as it is. How do I do that? It's very simple. You just need to cancel the special meaning of that thing. Right. So you want to print this string as it is, which is also called a raw string. So I want to print this one as a raw string. In that case, you just specify R before the thing and you will say C colon slash docs. slash Naveen. So we are printing this stuff as it is. So when you say R, it means raw string. Don't try to convert it. That's what you are saying to Python. Hey, don't just try to, don't try to convert that slash into a new special character and say enter. It works. Yeah. So everything is looking good now. So I hope you enjoyed this stuff, which we are doing here, playing with this stuff. So in this, in this video, we have only talked about how can we use certain operators and then playing with printf. In the next video, we're going to talk about how to use variables. Now, if you are enjoying this series, let me know in the comment section about your thoughts. And if you have any questions, you can put that as well. I do read your comments, by the way, so that I can answer that in the next video. And if you are liking my videos, click on the like button and do subscribe to the channel for further videos. Thank you so much, everyone. Bye-bye.