range question plz explain this question and its solution | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

range question plz explain this question and its solution

3. Write a program that prints following shape, (Hint: Use for loop inside another for loop) * ** *** **** *****

25th Feb 2020, 5:15 PM
Tauhid Anwar
Tauhid Anwar - avatar
2 Answers
+ 1
Thanks @swim
25th Feb 2020, 5:45 PM
Tauhid Anwar
Tauhid Anwar - avatar
0
for i in range(1,6): s = "*" for j in range(i): s += '*' print(s) i did the solution but showing some unexpected result. As we know the range exclude the end point but i am getting the result with end point. pla explain. my result is: ** *** **** ***** ******
25th Feb 2020, 5:38 PM
Tauhid Anwar
Tauhid Anwar - avatar