Format: Histogram

# Creating a histogram from a list of values.

int_values = []   # a list of values

# input 8 integers from user
print ("Enter 8 integers between the values of 1 and 10:")

for i in range( len(int_values) ):
   new_value = int( input( "Enter integer %d: " % ( i + 1 ) ) )
   int_values += [ new_value ]

# create histogram
print ("\nCreating a histogram from int_values:")
print ("%s %10s %10s" % ( "Element", "Value", "Histogram" ))

for i in range( len( int_values ) ):
   print ("%7d %10d  %s" % ( i, int_values[ i ], "*" * int_values[ i ] ))

Input/Output:

Enter 8 integers between the values of 1 and 10:
Enter integer 1: 1
Enter integer 2: 3
Enter integer 3: 4
Enter integer 4: 6
Enter integer 5: 5
Enter integer 6: 4
Enter integer 7: 3
Enter integer 8: 2

Creating a histogram from int_values:
Element      Value  Histogram
      0          1  *
      1          3  ***
      2          4  ****
      3          6  ******
      4          5  *****
      5          4  ****
      6          3  ***
      7          2  **
>>>