Rabu, 04 Mei 2011

Sample Looping Programs for Python 2

Just sharing the code for all,
You can copy an existing program code below

a = input ("enter the initial number : ")
b = input ("want to repeat how many times? : ")
c = str(a)
t = 10
while 0<=b:
    while a<=b-1:
        print c
        a = a+1
        d = str(a)
        c = c+d
   
    print c[:b]
    b=b-1

and the result will be as follows

2 komentar: