- 2

Friends help me with this code by using python ??

A B C D E F G H I J print above pattern without using ASCII value .

3rd Aug 2021, 2:24 AM
S ALI ABID ABIDI
S ALI ABID ABIDI - avatar
4 Respostas
+ 3
First show your attempts!! I can give you hint: 0 1 2 3 4 5 6 7 8 9 make a list or string which contains - "abc....j" , in my pattern you can take numbers as an index . Else try by your own!
3rd Aug 2021, 2:54 AM
Abhiyantā
Abhiyantā - avatar
+ 1
Here's a possibility: c = 0 for i in range(1, 5): for j in range(i): print(chr (65+c), end=" ") c += 1 print() # Hope this helps
3rd Aug 2021, 5:43 AM
Calvin Thomas
Calvin Thomas - avatar
0
S ALI ABID ABIDI Hint: Use the chr () function.
3rd Aug 2021, 5:41 AM
Calvin Thomas
Calvin Thomas - avatar
0
Now here's a one-liner: for i in range(1, 5): print(*map(lambda x: chr (64 + x), range((k := i * (i - 1) // 2 + 1), k + i))) # Hope this helps
3rd Aug 2021, 6:16 AM
Calvin Thomas
Calvin Thomas - avatar