Dcoder icon

The Triangle Game @ Dcoder

By Lochard | As a newbie programmer | 13 Jul 2023

Problem: Glin was doing his maths homework , Rick came to his house. As Glin is week at Maths, Rick decided to help him in his homework. They both stuck at a problem of Right Angle Triangle. You have to help them both in this problem.

Input is a String, You have to process it and design a Right angle triangle as explained later.

Input: Input is a String of characters, The right angle triangle is designed as explained through sample example.

Output: Print 1 character in firstline, then 2 characters in next line and so on, to design a Right Angle Triangle like Structure.

Constraints: Lenght of input String <= 20

Sample Input: Dcoder

Sample Output: 







s = input()
[print(s[:i+1]) for i in range(len(s))]

How do you rate this article?



Asylum seeker in Lithuania. My short-lifed daily on GitHub https://github.com/locharp/asylum_daily/tree/main/en

As a newbie programmer
As a newbie programmer

Sharing entry level codes. My snippets on GitHub https://github.com/locharp/code-snippets

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.