Pattern problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4
9th Feb 2022, 4:32 PM
Utsav Singh
Utsav Singh - avatar
5 Answers
+ 1
Try thinking again and again.. You will get ideas.. (4th one not an easy level)... You're welcome always..
10th Feb 2022, 11:23 AM
Jayakrishna 🇮🇳
+ 2
#Pattern 3 n=int(input()) i=0 while i<n: j=1 p=j #start from 1 while j<=i+1: print(p,end='') j=j+1 p=p+2 #add 2 print() i=i+1
9th Feb 2022, 4:48 PM
Jayakrishna 🇮🇳
+ 1
Jayakrishna🇮🇳 can you please tell where I’m doing mistake in pattern 4
9th Feb 2022, 5:27 PM
Utsav Singh
Utsav Singh - avatar
+ 1
Try to think again yourself. You will get it easily.. These are simple patterns.. Logic of looping is same but printing the value changing only... Think again once before I post solution ... edit: US22 you can use statement like print(p%2,end='') #instead of printing p or in assigning to p=p+1, use p=int(not p)
9th Feb 2022, 5:29 PM
Jayakrishna 🇮🇳
+ 1
Jayakrishna🇮🇳 thanks, your logic is correct I know pattern loop logic is same but sometime it become difficult for me when I got stuck.
10th Feb 2022, 2:00 AM
Utsav Singh
Utsav Singh - avatar