How do I need to fix my code and add in my code:
- if user enters height less than 0 set default to 3?
- if a character doesn't enter a character choice how do I set
default to * ?
Below is the output I want:
How do I adjust my code?
Example 2 $ python3 hollow.py Enter height of triangle: +2 Character: *** Example 3 $ python3 hollow.py Enter height of triangle: #5 Character: + Example 4 $ python3 hollow.py Enter height of triangle: 5-2 Character: vi 1 11 11111
in = int(input("Enter height of triangle: #")) 2 if ne: n = 3 3 4 a = input("Character: #") 5 if a=!': a 6 71 8 9 while ice(n): 18 j= 11 while j<(n-i): 12 print(" ', end='') 13 14 while j<=(2+i+1): 15 if j==8 or j==2+or j==n-1: 16 print(f' {a}', end='') }'' 17 else: 18 print('' end='') 19 1=1+1 28 print)
How do I need to fix my code and add in my code: - if user enters height less than 0 set default to 3? - if a character
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am