12 Dec 2016

Leisure Activity: Python3 wishes a good bye to 2016..!

Code:


 '''  
 Created on 12-Dec-2016  
   
 @author: linuxbeginner  
 '''  
 bye = ['B','Y','E']  
 two = ['T','W','O']  
 thousand = ['T','H','O','U','S','A','N','D']  
 sixteen = ['S','I','X','T','E','E','N']  
 num = ['2','0','1','6']  
 two_counter = 0  
 thousand_counter = 0  
 sixteen_counter = 0  
 num_counter = 0  
   
 print(end="\n")  
 for i in range(0,13):  
   for j in range(13,i,-1):  
     print(' ',end="")  
   for k in range(0,i+1):  
     if i == 0:  
       print('{0} '.format(bye[0]),end="")  
     elif i == 1:  
       print('{0} '.format(bye[1]),end="")  
     elif i == 2 and (k == 0 or k == 2):  
       print('{0} '.format(bye[2]),end="")  
     elif i == 4 and (k in range(1,4)):  
       print('{0} '.format(two[two_counter]),end="")  
       two_counter += 1  
     elif i == 7:  
       print('{0} '.format(thousand[thousand_counter]),end="")  
       thousand_counter += 1  
     elif i == 10 and (k in range(2,9)):  
       print('{0} '.format(sixteen[sixteen_counter]),end="")  
       sixteen_counter += 1  
     elif (i == 12 and (k in range(2,6))) or (i == 12 and (k in range(7,11))):  
       print('{0} '.format(num[num_counter]),end="")  
       num_counter += 1  
       if k == 5:  
         num_counter = 0  
     else:  
       print('* ',end="")  
   print(end="\n")  
 print(end="\n")  

Output:



No comments:

Post a Comment