mardi 27 octobre 2015

Looping for printing a Hollow Triangle Pattern

I need help to print a hollow triangle using for loops.

Here is what I have so far:

def typeTriangle(sizeofpattern): #using a simple counter 
firststar = 1
for i in range(sizeofpattern):
    print("*" * firststar)
    firststar+= 1

This prints:

Your Triangle Pattern: 
*
**
***
****
*****

Thanks and i appreciate your help!

Aucun commentaire:

Enregistrer un commentaire