Python Tutorial - Get Multiplication Table on console using PYTHON

Veröffentlicht am: 27 September 2017
auf dem Kanal: Appanna Damu
79
5

#Hi everyone,in this video am going to explain how to do simple multiplication table in python
#lets begin
#lets consider that below is the our requirement
2 x 1 = 2
2 x 2 = 4
2 x 3 = 6
2 x 4 = 8
like this we need to print on console
here 2 is constant it means not repeating
and repeated values are from 1 to 5
lets start the code,
here i want to take the values from key board
for that i will use input() method to read data from keyboard
#to get repeated values in result i will use for loop
here i used range function in for loop
it means that from 1 to 10(excluding 11) assigning to variable i,
so for every iteration variable 'i' will have from 1 to 10
use print statement
in print function we can give format of our requirement , means how you want to see out put on console
lets run the code,
ohh NO, the output what we see is not correct , our requirement is differ what discussed earlier like this
2 x 1 = 2
2 x 2 = 4
2 x 3 = 6
2 x 4 = 8

if you want to solve this issue , we have to look at input method,
in python or other programming languages , when you read data from keyboard ,by default it will consider as string data , but in our case we need interger data
so now we can change the code
this is called explicit conversion
now run the code,
wow , we got result what we expected on console
Thank you for watching this video


CODE:

num= int (input('enter number'))
for i in range(1,11):
print (num,'x',i,'=',num*i)


Auf dieser Seite können Sie das Online-Video Python Tutorial - Get Multiplication Table on console using PYTHON mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Appanna Damu 27 September 2017 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 79 Mal angesehen und es wurde von 5 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!