Question

Python 3 please and thank you

Task 3: Create a Function 7 Create the function TotalRewardPoints which accepts the dictionary that you created in Task 1 and

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Function to find total reward points that takes a dictionary (dic ) and ticket list (list)-

def TotalRewardPoints(dic, list): 
  i=0
  sumOfRewardPoints = 0  
  while i < (len(list) - 1): 
    numOfTickets = list[i] 
    typeOfTicket = list[i+1] 
    rewardPoint = dic[typeOfTicket] 
    reward_points = numOfTickets * rewardPoint 
    sumOfRewardPoints += reward_points 
    i += 2  
    print("The Total Reward Points is {}".format(sumOfRewardPoints)) 

dic = {"Member": 10, "Luxury":16} 
list = [4, "Member", 6, 'Luxury'] TotalRewardPoints(dic, list)

output:

The Total Reward Points is 136

(in this problem dictionary is not given so to show function at work i have guessed a dictionary. Please use the dictionary given in task 1 for real problem.

Add a comment
Know the answer?
Add Answer to:
Python 3 please and thank you Task 3: Create a Function 7 Create the function TotalRewardPoints...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Create a Python list (use first three letters of your name followed by the letter L...

    Create a Python list (use first three letters of your name followed by the letter L as the name of the list.) with the following data: 10, 20.0, 50.00, 7000, 7500, 7700, 7800, 8000, 9000, ‘python’. Display the entire list with an appropriate message. Display the 4th element in the list with an appropriate message. Display the first 3 values of the list only. Display all the values starting from the sixth element to the end of the list. Change...

  • PYTHON LANGUAGE Task 11 -Create a list with 5 items having 3 distinct data types -output...

    PYTHON LANGUAGE Task 11 -Create a list with 5 items having 3 distinct data types -output the second element of the list -output the last element of the list using -negative index -positive index -len method Task 12 -Create a list with 3 items -add an item to the end of the list -remove the first item of the list -determine if an item exists in the list -if it does, display its index -if it does not, give user...

  • In python 3 What you need to do? 1. 2. 3. Create a function implementing the...

    In python 3 What you need to do? 1. 2. 3. Create a function implementing the logic to a Pascal triangle. (You can use any logic of your choice to generate the triangle) Read an integer input from the user, to determine the number of rows to be generated in a Pascal triangle. Call the function by passing the input as an argument to the function. Hint: You can use a list of lists to store the values of a...

  • Expected submission: 1 Python file, Graph_Data.py Make a file called Graph_data Inside this file create 3...

    Expected submission: 1 Python file, Graph_Data.py Make a file called Graph_data Inside this file create 3 functions: 1.) BarGraph: This function should take 5 parameters, X-axis data, y-axis data, X-axis label, y-axis label, title. It will create a bar graph using the above data and display it. 2.) Line Graph: This function is the same as above, except with a line graph instead of a bar graph 3.) SaveGraph: This function is the same as BarGraph, except it saves the...

  • python 3 Define a function that uses two lists similar to the following to create a...

    python 3 Define a function that uses two lists similar to the following to create a dictionary: items = ['laptop', 'tablet', 'smartphone', 'reader', 'camera'] price = [749, 199, 399, 99, 1149] The dictionary should have the names of the items as keys and the prices as values. After creating the dictionary, ask the user to enter the name of an item, and display its price if the item is in the dictionary. If the item is not in the dictionary...

  • Please use Python 3, thank you~ Write a program that: Defines a function called find_item_in_grid, as...

    Please use Python 3, thank you~ Write a program that: Defines a function called find_item_in_grid, as described below. Calls the function find_item_in_grid and prints the result. The find_item_in_grid function should have one parameter, which it should assume is a list of lists (a 2D list). The function should ask the user for a row number and a column number. It should return (not print) the item in the 2D list at the row and column specified by the user. The...

  • write the following code in python 3.2+. Recursive function prefered. Thank you! Define a function named...

    write the following code in python 3.2+. Recursive function prefered. Thank you! Define a function named q3() that accepts a List of characters as a parameter and returns a Dictionary. The Dictionary values will be determined by counting the unique 3 letter combinations created by combining the values at index 0, 1, 2 in the List, then the values at index 1, 2, 3 and so on. The q3() function should continue analyzing each sequential 3 letter combination and using...

  • Python 3.x: Write a function typos(fname) that finds suspected typos in the file fname. To do...

    Python 3.x: Write a function typos(fname) that finds suspected typos in the file fname. To do that we need a dictionary, for which we use the file words.txt which is a reasonably complete list of English words (though you may disagree after running it on some sample texts). Any word in fname that is not in the dictionary should be printed, and we should be told how often it occurs in fname. Below I ran a Mark Train novel to...

  • In this project, you will use functions and dictionaries to track basketball players and their respective...

    In this project, you will use functions and dictionaries to track basketball players and their respective points, then display statistics of points made. You will need three functions as follows: def freeThrowMade(playerDictionary, playerName) - this function will add 1 point to the player's total score def twoPointMade(playerDictionary, playerName) - this function will add 2 points to the player's total score def threePointMade(playerDictionary, playerName) - this function will add 3 points to the player's total score Each of these functions has...

  • VERY URGENT*** THANK YOU IN ADVANCE: THIS IS THE CODE I HAVE GOTTEN SO FAR: PYTHON...

    VERY URGENT*** THANK YOU IN ADVANCE: THIS IS THE CODE I HAVE GOTTEN SO FAR: PYTHON This is a code that is supposed to help someone study/ practice for jeopardy. The two functions described below are required for this assignment. You may add other functions that you think are appropriate: menu() This function, which displays all the user options to the screen, prompt the user for their choice and returns their choice. This function will verify user input and ALWAYS...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT