Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
HW3-final
# python 3.5.2 # https://1drv.ms/f/s!ArsHV2FdZgQ1iQOclKKq2kqbxLdg # Homework exercise - Use for/while loops for completing the following design # * 3 blanks, 1 star # *** 2 blanks, 3 star # ***** 1 blanks, 5 star # ******* 0 blanks, 7 star # *** 2 blanks, 3 star # ***** 1 blanks, 5 star # ******* 0 blanks, 7 star # ||| 3 blanks, 3 line # ||| 3 blanks, 3 line i=0 for i in range(9): if i<=4: print(i, ' '*(4-i) + '*'*(i*2-1)) if 5<=i<=7: print(i, ' '*(7-i) + '*'*((i-5)*2+3)) if i>=8: print(i, ' '*2 + '|'*3) #........................................... i=0 while i<9: i=i+1 if i<=4: print(i, ' '*(4-i) + '*'*(i*2-1)) if 5<=i<=7: print(i, ' '*(7-i) + '*'*((i-5)*2+3)) if i>=8: print(i, ' '*2 + '|'*3) #........................................... N=81 n=9 while n<N: n=n+9 i=0 while i<n: i=i+1 if i<=(n//2): print(i, ' '*((n//2)-i) + '*'*(i*2-1)) if ((n//2)+1)<=i<=((n//2)+3): print(i, ' '*(((n//2)+3)-i) + '*'*((i-5)*2+3)) if i>=((n//2)+4): print(i, ' '*((n//2)-1) + '|'*3)
run
|
edit
|
history
|
help
0
H
.....✓[Guess the number]®®®®®®®•$$$$✓.....
python_study_note_while loop
PyRegSearch
PyStack
mansur
My name
pyEnumAuto
gj
Well, this seems bad.