python: Print the table of enter value

#!/usr/bin/python
import sys
c = input("What Table you want to learn ")
print "you have entered table of ",c
a = range(1,11)
print a
for b in a:
        print  c,"*",b,"=", b * c


Output: 
[root@mysql Scripts]# python for.py
What Table you want to learn 4
you have entered table of  4
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
4 * 1 = 4
4 * 2 = 8
4 * 3 = 12
4 * 4 = 16
4 * 5 = 20
4 * 6 = 24
4 * 7 = 28
4 * 8 = 32
4 * 9 = 36
4 * 10 = 40
[root@mysql Scripts]# python for.py
What Table you want to learn 6
you have entered table of  6
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
6 * 1 = 6
6 * 2 = 12
6 * 3 = 18
6 * 4 = 24
6 * 5 = 30
6 * 6 = 36
6 * 7 = 42
6 * 8 = 48
6 * 9 = 54
6 * 10 = 60

Comments

Popular posts from this blog

How to delete SEA in VIOS

More VIOS commands

Webmin configuration for LDAP