CBSE Class 11 Computer Science Question 39 of 43

Flow of Control — Question 34

Back to all questions
34
Question

Question 26

Write a program using nested loops to produce a rectangle of *'s with 6 rows and 20 *'s per row.

Solution
for i in range(6) :
    for j in range(20) :
        print('*', end = '')
    print()
Output
********************
********************
********************
********************
********************
********************
Answer

for
i
in
range
(
6
) :
for
j
in
range
(
20
) :
print
(
'*'
,
end
=
''
)
print
()
Output
********************
********************
********************
********************
********************
********************