[Begginers Tutorial] How to create tables of any number in Python


[BEGGINER'S PROJECTHow To Write Tables of any number in Python :


                                                                SOURCE:geeksforgeeks.org



STEPS

1. First of all we need to take a variable and ask user or system to input a number, whose table he wants.


Here num is the variable which asks an input in form of integer to the user.








                                                

                                            advertisements


2. We know that in a table of any integer. The integer is multiplied with 1, 2,...,10 to get its table. So our next target is to get a variable which is assigned 1 and its value increment by 1 each time it is run.

Here p is the variable which stores 1 as its temporary value.

3. Now we need to loop the program to increment the value of p by 1 each time until its value reaches 10.

Here I have shown the looping using 'while' loop .You can even do it by 'for loop ', which ever suits you the best.




    
    








                                                advertisements


So by here  we have completed our small project of creating tables of any no.Lets move to see the output generated by our code.




Gotcha! We have done our project successfully.

Hope you enjoyed creating it and learned some concepts through it .

Do follow our channel for more such codes and intresting projects. See you soon!

 

Post a Comment

Previous Post Next Post