The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Ask
Anybody can ask a question
Answer
Anybody can answer
Vote
The best answers are voted up and moderated by our team

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

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

0
Votes
0
Answer

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. 

No answers so far.
JanuaryPromo
×
Complete Data Science Education
Get 50% OFF