Skip to content

Instantly share code, notes, and snippets.

@EdwardReed
Created October 23, 2012 20:39
Show Gist options
  • Save EdwardReed/3941398 to your computer and use it in GitHub Desktop.
Save EdwardReed/3941398 to your computer and use it in GitHub Desktop.
pa5.py
# Author: Edward Reed
# CLID: exr3920
# Course/Section: CMPS 150 -- Section 001
# Assignment: pa5
# Date Assigned: Thursday, October 17, 2012
# Date/Time Due: Tuesday, October 23, 2012 –- 11:55 pm
# Description: Program will process theatre ticket information for 5 customers.
# Certification of Authenticity:
# I certify that this assignment is entirely my own work.
print(" Name Adult Child Total")
print("------------------------------------------------------------------------")
data = open("pa5.input", "r")
stuff = data.read()
data.close()
stuff = stuff.split()
numPeople = len(stuff)
for i in range(0, numPeople, 4):
firstName = stuff[i]
lastName = stuff[i+1]
adult_tickets = eval(stuff[i+2])
child_tickets = eval(stuff[i+3])
adult_price = 9.50
adult_price = adult_price + adult_price * .08
child_price = 7.50
child_price = child_price + child_price * .08
total_price = adult_price + child_price
print(firstName+" "+lastName+" "+adult_tickets," ",adult_price," "child_tickets," "+" ",total_price)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment