Posted on:

27 Nov 2020

0

Q : (Python Programmer Bootcamp Lecture) Why there should be print() in this solution?

This is on 7.8 exercise from Python Programmer Bootcamp lecture: star = '*'
for i in range(1,7):
     for j in range(1,6):
          if i == 1 and j < 6:
               print(star, end='')
          elif i ==2 and j == 1:
               print()
               print(star)
          elif i == 3 and j < 5:
               print(star, end='')
          elif i == 4 and j == 1:
               print()
               print(star)
          elif i == 5 and j == 1:
               print(star)
          elif i == 6 and j == 1:
               print(star)   I do not understand why there should be 'print()' in some case and should not in other cases. It seems like everytimg print(... , end = ' ') comes, there should be an empty print() to break from end = ' '. Please explain and help this novice. :) By the way, the lecturer in this lecture is more than amazing. Very easy to understand and well-organized for novice. Thanks. 
0 answers ( 0 marked as helpful)

Submit an answer