Description:
This is a very simple star or asterisk pyramid generator using Python 3.3.2. It uses the command prompt, similar to Visual Basic.Net's console application.


Notes:
You can easily convert this to compile with Python 2, just change input() to raw_input()


Plans:
I plan to properly parse the numeric datatypes. Currently I'm just using int([string]), which is fine if the user enters in a numeric data type, but if the user enters in a non-numeric character then it will crash the program.


Source:
Python Code:
  1. #This generates the stars
  2. def gen_stars(i):
  3.     #Start off with a blank string
  4.     stars = ""
  5.     #Loop from 0 to i
  6.     for up in range(0, i + 1):
  7.         #Add a * and print it
  8.         stars += "*"
  9.         print (stars)
  10.        
  11.     #Loop from i to 0
  12.     for down in range(i, 0, -1):
  13.         #Remove the last character of stars and print what we got
  14.         stars = stars[:-1]
  15.         print (stars)
  16.    
  17.  
  18. while True == True:
  19.     #Get the input, I put 1 - 78 b/c 78 is the furthest it'll go without word wrap screwing it up
  20.     i = int(input("Please enter in a number from 1 - 78: "))
  21.     if i > 0 and i <= 78:
  22.         gen_stars(i)
  23.         print ()
  24.     else:
  25.         print ("Invalid Input.")