Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Homework exercise
# 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)
run
|
edit
|
history
|
help
0
python_study_note_while loop
Transpose matrix
hw1
guess123
python lesson 1 function
sheru
two-digits-puzzle
filtering python3
Faiha #4
Lawrence.py