Advertisement
mmandrille

Untitled

Aug 17th, 2022
621
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.05 KB | None | 0 0
  1. '''
  2. After Drawing this calculations:
  3. lvl     draw        fx
  4. 0       1           1 + (2*lvl)         0 = 1
  5. 1       3           1 + (2*lvl)         2 + 1 = 3
  6. 2       5           1 + (2*lvl)         4 + 1 = 5
  7. 3       CENTER      "CENTER"
  8. 4       5           max_draw - (((lvl-center) - 1) * 2 )
  9. 5       3           max_draw - (((lvl-center) - 1) * 2 )
  10. 6       1           max_draw - (((lvl-center) - 1) * 2 )
  11.  
  12. max_lvl = 7
  13. widht = 21
  14. center = (max_lvl-1)/2 = 3
  15. max_draw = max_lvl - 2
  16. '''
  17.  
  18. height, widht =  list(map(int, input().split()))
  19.  
  20. # Some calculations
  21. middle_line = int((height-1)/2)
  22. max_draw = height - 2 # I dont really know if its a rule xD
  23. pattern = ".|."
  24.  
  25. # Drawing:
  26. for lvl in range(height):
  27.     # Before center:
  28.     if lvl < middle_line:
  29.         items = 1+(2 * lvl)
  30.         print(f'{items*pattern}'.center(widht,"-"))
  31.  
  32.     elif lvl ==  middle_line:
  33.         print("WELCOME".center(widht,"-"))
  34.  
  35.     elif lvl > middle_line:
  36.         items = max_draw - (((lvl-middle_line) - 1) * 2 )
  37.         print(f'{items*pattern}'.center(widht,"-"))
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement