import pandas # currency formatting deatils def currency(x): return "${:.2f}".format(x) # dictionaries to hold ticket details all_names = ["a", "b", "c", "d", "e"] all_ticket_costs = [7.50, 7.50, 10.50, 10.50, 6.50] surcharge = [0, 0, 0.53, 0.53, 0] mini_movie_dict = { "Name": all_names, "Ticket Price": all_ticket_costs, "surcharge": surcharge } mini_movie_frame = pandas.DataFrame(mini_movie_dict) # Calculate the total ticket cost (ticket + surcharge) mini_movie_frame['Total'] = mini_movie_frame['surcharge'] \ + mini_movie_frame['Ticket Price'] # calculate the profit for each ticket mini_movie_frame['Profit'] = mini_movie_frame['Ticket Price'] - 5 # calculate ticket and profit totals total = mini_movie_frame['Total'].sum() profit = mini_movie_frame['Profit'].sum() # currency formatting (use currency functions) add_dollars = ['Ticket Price', 'surcharge', 'Total', 'Profit'] for var_item in add_dollars: mini_movie_frame[var_item] = mini_movie_frame[var_item].apply(currency) print(mini_movie_frame) #output total ticket sales and profit print(f"Total Ticket Sale: ${total}") print(f"Total Profit : ${profit}")