Hackerrank Python Triangle Quest Solution

This is the solution for the question at hackerrank, python triangle quest solution. In the question you have to display the output using just a single for loop and a print statement. If used more then 2 lines of code you will not be awarded any score. So here is that simple 2 line of code using which u can solve triangle quest which is a moderate(difficult) level question.

Screenshot/ Outputs


The complete 2 line code
for i in range(1,input()):
    print ((10**i - 1)/ 9)*i

If this post helped you, please share it ! :)

Comments

Post a Comment

Popular posts from this blog

Non Restoring Division Algorithm Implementation in C

Bit Stuffing Code Implementation in Java

Employee Management System Using Inheritance in Java