nanokatka

strings-task3

Feb 7th, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. print("Triangles")
  2. height=int(input("Enter height:"))
  3. character=input("Enter character:")
  4. print('1) 2) 3) 4) 5) 6)')
  5. print('* * * ***** *** ***')
  6. print('** ** *** *** ** **')
  7. print('*** *** ***** * * *')
  8. shape=input("Enter shape number (select from schemes above):")
  9.  
  10. for i in range(height+1):
  11. if shape == ('1' or '1)'):
  12. print(i * character)
  13. elif shape == ('2' or '2)'):
  14. print((height - i) * ' ' + i * character)
  15. elif shape == ('3' or '3)'):
  16. print((height-i) * ' ' + (2*i+1) * character)
  17. elif shape == ('4' or '4)'):
  18. print(i * ' ' + ((height-i)*2-1) * character)
  19. elif shape == ('5' or '5)'):
  20. print((height-i)*character)
  21. elif shape == ('6' or '6)'):
  22. print(i * ' ' + (height-i)*character)
  23. else:
  24. print("wrong entry for shape type")
Advertisement
Add Comment
Please, Sign In to add comment