+ 1

How do I print this square pattern?

I'm trying to print a square pattern. The input will be the size of the pattern. For example when inpu(n) is 5, the below pattern should be printed 12345 22345 33345 44445 55555 Here it is what I tried so far :( https://code.sololearn.com/c4NpBPKhuV0q/?ref=app

6th Aug 2021, 2:21 PM
Python Learner
Python Learner - avatar
3 Antworten
+ 5
Perfect! Thank you guys!
6th Aug 2021, 4:55 PM
Python Learner
Python Learner - avatar
+ 3
Here's a one-liner: for i in range(1, a := int(input()) + 1): print("".join(map(str, range(i, a))).rjust(a - 1, str(i))) Edit: for i in range(1, a := int(input()) + 1): print(str(i) * i, *range(i + 1, a), sep="") # Hope this helps
6th Aug 2021, 4:45 PM
Calvin Thomas
Calvin Thomas - avatar
0
i want to ask how, do we create link to other page, if im using phone, i create 2 file html, so how can i link to other file hmm
8th Aug 2021, 10:25 AM
anis