Well guys, now we have another program to check whether a given number is a palindrome. Now, as we know, palindrome is a text or a number which is equal to its reverse. So, what we do is, of course, the first line defines about the online Python compiler. Then we have a remark saying Python program to check whether a given number is a palindrome. So, we have an input here with the message Hi, please enter a number to check for if it is a palindrome. So, the number M gets assigned in the variable temp reverse is zero as used in the last program technique.
We will take a loop by loop till the number is zero. It will approach the that is a digit, extract the digit multiply Get the reverse. So finally, we get the reverse of a number in the variable, V, and the temp variable has the original number because the written number has changed to the reverse. So we need to have this variable temp with us. And now we check whether the original number is equal to the reverse of its number. If it is, so, we use an if else statement to check if temp is equal to reverse the number is a palindrome as the number is not a palindrome.
So this is the logic of the program. We check it by running it and when we run it, we press f9 or we click on to the run. Right. And then here, we have an output, which last Hi, please enter a number to check if it is a palindrome. So let's try a number which is not a palindrome. For example, 123 we check it out, it is not a palindrome right and we press EXIT to continue.
Now, we run again we enter another number say 121 right check it is a palindrome is a balance. So, we have this small module, which talks about the important logic right. So, for to find the palindrome It is one of the very, very important programs, which is as in any programming language, so, maybe Python maybe C, maybe c++, maybe Java, maybe basic, maybe COBOL. But the logic remains same that we extract the number one by one extract the digit stole that digit in a reverse format. And this logic of extracting the digit and getting it into reverse is actually the logic which is being used in many, many programs. So, I hope the children and the guys who are taking this course should be very clear of how we are extracting the digits in this format.
Now, friends, our next program is a very, very simple program. It starts about inputting a number and printing the table of that number. So, we use it as a simple program to explain the concept of various functions statements. So, here what we do is we input a number and whose table has to be printed and then we create a range from one to 11 that means one to 10. In reality, and every time we create the value of hi from ranging from zero to 10, right, so of course one to 10 that is the first one we have taken it from one to 11 where 11 is not found today. And then we are displaying it in this form.
So let's see what we run it we do it here it says enter the number to print the table for say I write five. So, five one and accordingly we get the table. If we want to continue with of course, we can run it again with some other number. For example, we get a table right? The computation here talks about the range function, which generates numbers from one to 10. And if I make it Say for example, 13 over here, so, now the range displayed will be one to say I want to think the table eight.
So now it will be till 12 times right The difference, we thought manipulating the data. This is the sample screen, as you can see before you write, and you can even put it at a smaller phase. And this is the program which allows you to display the table of any given number in Python. So we are dealing with learning Python basics, I don't club to teach you right, the the basic level, something like making an app or something is that my objective is to make you familiar with the basic concepts of Python programming in this very format.