+ 4
Pattern problem
Hii My approached to the problem below https://www.sololearn.com/learn/934/ My Approach:- https://code.sololearn.com/ci2cqHzkk41x/?ref=app
5 Respostas
+ 1
Try thinking again and again.. You will get ideas..
(4th one not an easy level)...
You're welcome always..
+ 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
+ 1
Jayakrishna🇮🇳 can you please tell where I’m doing mistake in pattern 4
+ 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)
+ 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.