We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

- Prepare
- Python
- Math
- Triangle Quest 2
- Discussions

# Triangle Quest 2

# Triangle Quest 2

#### Sort by

recency

#### |

#### 1085 Discussions

#### |

Please Login in order to post a comment

It's necessary to use Demlo numbers because using another for is not allowed.

You don't need Demlo numbers. Try using:

sum,map,lambda,rangeand the ternary conditional operatorx if cond else yaltogether: map and lambda will save you from using an extraforkeyword.print(int((1/81)*(((10**i)-1))**2))

It's called a Demlo Number and for n<=9 it is true. I only get 12 points from 20 though :)

n = int(input())

for i in range(1, n+1): for j in range(1, i+1): print(j, end='') for k in range(i-1, 0, -1): print(k, end='') print('\r')

Wrong Answer only 1 print statement is allowed

for i in range(1, int(input())+1): #More than 2 lines will result in 0 score. Do not leave a blank line also print(((10 ** i) // 9) ** 2)