Use a nested for loop | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Use a nested for loop

Print: **** *** **** *** My code: for row in range(4): for col in range(4): if(): print(end = " ") else: print('*', end = ' ') print()

22nd Feb 2022, 12:48 AM
Jaz
Jaz - avatar
2 Answers
+ 5
You can also put this condition in your program if(col == 0 and row % 2 == 1): Because we can see that in even rows and when col is 0 then only it's showing spaces https://code.sololearn.com/c35hafb2F5Q5/?ref=app It's your code only just given the condition Happy Learning 🙂
22nd Feb 2022, 1:43 AM
Abhiyantā
Abhiyantā - avatar
+ 3
Mirielle & Abhiyantā thank you guysss
22nd Feb 2022, 1:47 AM
Jaz
Jaz - avatar