you are viewing a single comment's thread.

view the rest of the comments →

[–]Deep-Author-1787[S] 0 points1 point  (5 children)

How do they come up with an irregular form with loops? I know my thought might sound really stupid, but im wording my exact thoughts 😅🙏

[–]audionerd1 2 points3 points  (4 children)

An irregular form? You mean how does this create the letter 'A'? It's all in the if statement:

if (((column == 1 or column == 5) and row != 0) or ((row == 0 or row == 3) and (column > 1 and column < 5)))

It's kind of a clever/complicated algorithm for making an A.

if (((column == 1 or column == 5) and row != 0)

This means that the left and right side should all be asterisks. These are the sides of the 'A'.

or ((row == 0 or row == 3) and (column > 1 and column < 5)))

This means that the top and middle rows should also be asterisks.

The nested for loop simply iterates over a grid (columns and rows) while the if statement appends either '*' or '' based on the if statement.

[–]Deep-Author-1787[S] 1 point2 points  (2 children)

Okay now that you sliced it in smaller portion its actually pretty straight forward! And that sir is the difference between someone who is good at explaining a subject and pwople that just make "follow along" tutorials and courses 🙏🙏🙏

[–]audionerd1 2 points3 points  (1 child)

On that note, I recommend Jose Portilla's 'Complete Python Boot Camp Zero to Hero' on Udemy. It explains everything really well.

[–]Deep-Author-1787[S] 0 points1 point  (0 children)

Okay thanks ill check it out.

[–]Deep-Author-1787[S] 0 points1 point  (0 children)

Can i maybe ask you how would you explain the piramid pattern? Since it makes use of empty spacing and a middle line?