Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def diamond(start, fini, half):
- if start < fini:
- if start <= half:
- print(f"{' ' * (half - start)}{'* ' * ((start << 1) + 1)}")
- else:
- print(f"{' ' * (start - half)}{'* ' * ((fini - start << 1) - 1)}")
- diamond(start + 1, fini, half)
- 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(0, height, height >> 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement