Define the get_fail_pass_average() function which is passed a list of integers called number_list as a parameter where each integer | represents a mark out of 100. The function returns a Python list made up of

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

use py only

Define the get_fail_pass_average() function which is passed a list
of integers called number_list as a parameter where each integer
represents a mark out of 100. The function returns a Python list made up of
the average of all the marks which are less than 50, followed by the average of
all the marks which are 50 or more (both averages are rounded to the nearest
whole number). If there are no fail marks then the average fail mark should be
set to -1 and if there are no pass marks then the average pass mark should be
set to -1. Some examples of the function being called are shown below.
For example:
Test
Result
print(get_fail_pass_average( [63, 65, 33]))
[33, 64]
print(get_fail_pass_average( [63, 62, 100, 100]))
[-1, 81]
print(get_fail_pass_average( [33, 42, 20, 10]))
[26, -1]
Transcribed Image Text:Define the get_fail_pass_average() function which is passed a list of integers called number_list as a parameter where each integer represents a mark out of 100. The function returns a Python list made up of the average of all the marks which are less than 50, followed by the average of all the marks which are 50 or more (both averages are rounded to the nearest whole number). If there are no fail marks then the average fail mark should be set to -1 and if there are no pass marks then the average pass mark should be set to -1. Some examples of the function being called are shown below. For example: Test Result print(get_fail_pass_average( [63, 65, 33])) [33, 64] print(get_fail_pass_average( [63, 62, 100, 100])) [-1, 81] print(get_fail_pass_average( [33, 42, 20, 10])) [26, -1]
Complete the add_adjacent_list_values() function that takes a list of numerical values as a parameter named numbers_list. If
the list has 2 or more elements, then each element of the list is updated so that it is equal to the sum of itself and the next element. In other
words, the first element will be updated so that it has the value of the sum of the first and second elements. The second element will be
updated so that it has the value of the sum of the second and third elements and so on. The last element of the list is updated, so that it has
the value of the sum of itself and the original value of the first element. If the list has less than 2 elements, it remains unchanged.
Note, that the function does not return a new list - the parameter list is modified within the function only. Some examples of the function
being called are shown below.
For example:
Test
Result
numbers_list = [1, 2, 3 ,4, 5]
print ("Before:", numbers_list)
add_adjacent_list_values(numbers_list)
print("After:", numbers_list)
Before: [1, 2, 3, 4, 5]
After: [3, 5, 7, 9, 6]
numbers_list = [2.5, 3]
print ("Before:", numbers_list)
add_adjacent_list_values(numbers_list)
print("After:", numbers_list)
Before: [2.5, 3]
After: [5.5, 5.5]
Before: []
numbers_list = []
print("Before:", numbers_list)
add_adjacent_list_values(numbers_list)
print("After:", numbers_list)
After: []
Transcribed Image Text:Complete the add_adjacent_list_values() function that takes a list of numerical values as a parameter named numbers_list. If the list has 2 or more elements, then each element of the list is updated so that it is equal to the sum of itself and the next element. In other words, the first element will be updated so that it has the value of the sum of the first and second elements. The second element will be updated so that it has the value of the sum of the second and third elements and so on. The last element of the list is updated, so that it has the value of the sum of itself and the original value of the first element. If the list has less than 2 elements, it remains unchanged. Note, that the function does not return a new list - the parameter list is modified within the function only. Some examples of the function being called are shown below. For example: Test Result numbers_list = [1, 2, 3 ,4, 5] print ("Before:", numbers_list) add_adjacent_list_values(numbers_list) print("After:", numbers_list) Before: [1, 2, 3, 4, 5] After: [3, 5, 7, 9, 6] numbers_list = [2.5, 3] print ("Before:", numbers_list) add_adjacent_list_values(numbers_list) print("After:", numbers_list) Before: [2.5, 3] After: [5.5, 5.5] Before: [] numbers_list = [] print("Before:", numbers_list) add_adjacent_list_values(numbers_list) print("After:", numbers_list) After: []
Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Binary numbers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education