Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Lesson 3 HW-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)-2) + '|'*3)
run
|
edit
|
history
|
help
0
ElaineBrown** rextester.com
Like.C.M.
problem
single inheritance
mat
Сумма цифр пятизначного числа
~2668 Pime Numbers list
ms 80
Lesson8
My Personal data