165k views
3 votes
Write nested loops to print a rectangle. sample output for given program:* * * * * *

User Yifu Yan
by
7.1k points

2 Answers

3 votes

Answer:

for i in range(num_rows):

print('*', end=' ')

for j in range(num_cols-1):

i*=j

Step-by-step explanation:

The above answer didnt work for me, instead I entered the above and it ran correctly. Hope this helps!

User Rvdginste
by
7.6k points
3 votes
Answer: num_rows = 2 num_cols = 3 for i in range(num_rows): for j in range(num_cols): print('*', end=' ') print('')
User Justin Cherniak
by
7.3k points