David B. Paradice, Ph.D.

Harbert Eminent Scholar in Business Analytics
Raymond J. Harbert College of Business
Auburn University

Python Programs and Examples

Click on the program name to download the code.

bottles-of-beer.py: the drinking song (looping)

csv-to-xml.py: reads a csv file, outputs the same data in an XML format

csvfileio.py: read and write a CSV file

dictionary-lookup.py: using a dictionary to look up a value

dictionary-loop.py: looping through a dictionary (looping)

displaying-files.py: program that displays the contents of files (looping)

factorial.py: calculates the factorial of n (i.e., n!) [n! = n * (n-1) * (n-2) * ... * 1]

factorial-recursive.py: calculates the factorial of n (n!) using recursion

fibonacci.py: constructs a Fibonacci sequence (1, 1, 2, 3, 5, 8, 13, ...)

fibonacci-recursive.py: constructs a Fibonacci sequence (1, 1, 2, 3, 5, 8, 13, ...) using recursion

for-loop.py: a for loop example (looping)

get-weather-data.py: scrapes weather data (web scraping)

guessing-game.py: guess the number (looping)

hello.py: the simplest python program

simple-stuff.py: some simple operations, including input and output

string-match.py: a simple string matching example.