+ 2
Can we make string triangle code into string pyramid ? But how?
python 3 code https://code.sololearn.com/cLAQ4wU9zrlw/?ref=app
5 odpowiedzi
+ 4
It still looks line a triangle to me. Anyway, I added a line and a character to your code, and it should work now.
string = input("Enter a string \n")
length = len(string)
for row in range(length):
    print(" "*(length-row-1), end="")
    for col in range(row+1):
        print(string[col],end=" ")
    print()
+ 4
for p in range(len(string)):
    print(" "*(len(string)-p-1) + " ".join(list(string[:p+1])))
+ 1
example:-
                        *
                       * *
                      * * *
                     * * * *
                    * * * * *
                   * * * * * *
+ 1
another example is
      
                  p
                p  y
              p  y  t
            p  y   t   h
          p  y   t   h   o
        p y  t   h   o    n
0
What's a string pyramid? Could you please give an example?



