lundi 29 février 2016

Print the reverse of an arrow pattern in Python

Right now this code gives me:

*
 *
  *
   *

And I can't seem to figure out how to get the arrow finish off (in other words reversing the first print):

*
 *
  *
   *
   *
  *
 *
*

--

columns = int(input("How many columns? "))

while columns <= 0:
    print ("Invalid entry, try again!")
    columns = int(input("How many columns? "))

x = 1
for x in range(columns):
        for x in range(x):print(" ", end="")
        print("*")

Aucun commentaire:

Enregistrer un commentaire