วันอาทิตย์ที่ 1 พฤศจิกายน พ.ศ. 2558

[LAB7] BANNER LETTER #INCOMPLETE

class words:
   def __init__(self,first,second,third,fourth,fifth):
      self.first = first
      self.second = second
      self.third = third
      self.fourth = fourth
      self.fifth = fifth
 
   def display_L_first(self):
      print(self.first,end = "")
   def display_L_second(self):
      print(self.second,end = "")
   def display_L_third(self):
      print(self.third,end = "")
   def display_L_fourth(self):
      print(self.fourth,end = "")
   def display_L_fifth(self):
      print(self.fifth,end = "")
   
   def get_word_L_first(self):
      return self.first
   def get_word_L_second(self):
      return self.second
   def get_word_L_third(self):
      return self.third
   def get_word_L_fourth(self):
      return self.fourth
   def get_word_L_fifth(self):
      return self.fifth
 
   def star_first(self):
      hashtag_star(self.first)
   def star_second(self):
      hashtag_star(self.second)
   def star_third(self):
      hashtag_star(self.third)
   def star_fourth(self):
      hashtag_star(self.fourth)
   def star_fifth(self):
      hashtag_star(self.fifth)
   
   
def setup():
   B = words("#####","#   #","#####","#   #","#####")
   U = words("#   #","#   #","#   #","#   #"," ### ")
   N = words("#   #","##  #","# # #","#  ##","#   #")
   G = words(" ####","#    ","# ###","#   #","#####")
   letter = [B,U,N,G]
   word = input("")
   draw_word(letter,word)

def draw_word(letter,word):
   i_print = 0
   while(i_print < 5):
      i = 0
      while(i < len(word)):
         if(word[i] == "B"):
            fun_print(letter,i_print,0)
         elif(word[i] == "L"):
            fun_print(letter,i_print,1)
         elif(word[i] == "U"):
            fun_print(letter,i_print,2)
         elif(word[i] == "E"):
            fun_print(letter,i_print,3)
         i = i + 1
         print()
         i_print = i_print + 1

def hashtag_star(temp):
   i = 0
   while(i < len(temp)):
         if(temp[i] == "#"):
            print("*",end = "")
         else:
            print(" ",end = "")
         i = i + 1
       
def fun_print(letter,i_print,word_index):
   if(i_print == 0):
      letter[word_index].star_first()
   elif(i_print == 1):
      letter[word_index].star_second()
   elif(i_print == 2):
      letter[word_index].star_third()
   elif(i_print == 3):
      letter[word_index].star_fourth()
   elif(i_print == 4):
      letter[word_index].star_fifth()
 
setup()

ไม่มีความคิดเห็น:

แสดงความคิดเห็น