Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def diamond(rows):
- spaces = " " * (rows * 2)
- stars = "* "
- for _ in range(rows):
- print(f"{spaces}{stars}")
- spaces = spaces[2:]
- stars += "* * "
- for _ in range(rows + 1):
- print(f"{spaces}{stars}")
- spaces += " "
- stars = stars[4:]
- try:
- height = int(input('Enter height (>4 and odd): '))
- if not height > 4 or not height & 1:
- raise ValueError
- except ValueError:
- print('That is not going to work')
- height = None
- if height:
- diamond(int(height/2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement