174k views
2 votes
Which XXX/YYY combination will create a rectangle of '*' characters, with 5 rows, and each row containing 10'*' characters? for XXX: for YYY: print('*', end='') print() O a.i in range (5) / j in range (10) O b.i in range (10) / j in range (5) O c. i in range (1, 5) / j in range(1, 10) O d. i in range

1 Answer

5 votes

Answer:

The correct combination to create a rectangle of '*' characters with 5 rows, and each row containing 10 '*' characters is:

a. i in range (5) / j in range (10)

Step-by-step explanation:

XXX: for i in range(5)

This will iterate through the loop 5 times, creating 5 rows.

YYY: for j in range(10)

This will iterate through the loop 10 times, creating 10 '*' characters in each row.

The complete code would look like this:

for i in range(5):

for j in range(10):

print('*', end='')

print()

This code will print 5 rows of '' characters, with 10 '' characters in each row.

Option b is incorrect because it will create 10 rows with 5 '*' characters in each row.

Option c is incorrect because it will create 4 rows with 9 '*' characters in each row, as the range starts from 1 instead of 0.

Option d is incomplete, so it cannot be evaluated.

User Sanique
by
7.5k points