Question: Credit Card List Complete the following skeleton code as indicated by the comments for each function.. You should remove my comments and put in your
Credit Card List Complete the following skeleton code as indicated by the comments for each function. You should remove my comments and put in your own function headers and inline comments. You should also add an appropriate program header. You may need to change the parameters in the functions. You may NOT have any global variables in your program The program keeps track of a set of giftcards. The variable giftcard Amounts refers to a list of tuples. Each tuple is of the format ("place of business", dollar amount). There may be several gift cards from the same location -- so, for amazon, there are 3 cards one for $200, one for $300 and one for $400. The program consists of a number of functions that will use the gift card list in various ways def totalAmounts location): #given the nane of a location, return the total anount value of the gift cards in the list for that location #renove these comments and add your own when you hand in your assignment pass det allTotals giftcards): #given a list of tuples of the form (location, anount), print out the information formatted like this: this function nust make use of the function called totalnounts defined above pass def increase sazonCards/giftcards #increase the amount of each amazon gift card by $58. pass def addNewCards): turite the function to add a new card (and mount) to the list of gift cards. this function will prompt the user for the card location and the amount and add Hit to the list. pass def combineCards(): write a function that will take the list of cards and combine the anounts for the #cards from the same location. #your function should not change the original list, but instead create a new list #containing only unique locations and the total of the cards for that location This new list should be returned. The format should be Ii location, totalAmount)location, tota Amount) ... pass def numberOfCards(): this function should take as a parameter a location and it should return the number of cards in the list for that particular location. there should be NO USER INPUT in this function and no print) statements. pass def main(): make your progran user friendly by adding print statements telling the user what is happening giftCardAmounts (amazon", 200), (mastercard", 250), (anazon", 300), {"esso", 250), Mastercard", 300), "semphora", 100) ("senphora", 200), ("anazon", 400), (esso", 2003 print("This progran doesn't do anything yet. Complete the program as per the connents) #call totalmounts) with location equal to "semphora" #call totalAmounts() with location equal to "asazon" #call allTotals() call increase AmazonCards call allTotals) again #call addNewCards() #call allTotals) again #call combineCards() and assign it to a new variable #print the result ask the user for a location call numberOfCards (using the original giftCardArounts list) and print the result main(
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
