Cloud Stack Ninja

I am trying to take a string and print a descending triangle that removes one character until there are no characters left. For example if "hello" was inputed this would be the output:


I am supposed to do it with both using with two separate functions, one using iteration and the other recursion so it outputs the triangle twice. This is what I have so far but I don't think it's very close.

    for i in range(len(text)):

I also tried this but it just takes the entire string

    for i in range(len(text), 0, -1):
    for j in range(0,i):
        print(text, end="")

Read more here:

Content Attribution

This content was originally published by srogers2000 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: