python help, please show all steps and include comments Write a function largerLst() that takes a list of numbers (i.e., int or float values) as a parameter and returns a new list constructed out of it. The list returned has all the values in the parameter list that are larger than the element immediately to their right, that is, larger than their right neighbor. If the parameter list is empty or there are no values larger than their right neighbor, then the function returns an empty list. Note that the last element in the list will never be included in the list returned since it does not have a right neighbor. The function should not change the parameter list in any way. Note that a correct solution to this problem must use an indexed loop That is, one that makes a call to the range() function to generate indices into the list which are used to solve the problem (Review lecture notes 8-1). A solution that does not use an indexed loop will not be accepted. Note in particular that you are not allowed to use the index() or find() methods of the list class. Don’t forget to include the docstring and comments. Copy and paste or screen shot the code and the eight test cases shown below in your submission.      >>> largerLst([31]) # test with only one item [] >>> largerLst([]) # test empty list [] >>> nlst1 = [1,3.3,5,7.7,9] # assign a list to a variable name >>> largerLst(nlst1) # use the list name in the function [] >>> nlst1 [1, 3.3, 5, 7.7, 9] # display the list to show that it was not modified >>> nlst2 = [-3.5,4,-1.5,8,0,17.7,10] >>> largerLst(nlst2) [4, 8, 17.7] >>> nlst2 [-3.5, 4, -1.5, 8, 0, 17.7, 10] >>> nlst3 = [1.1,0.75,2,3.75,1.5,10,3.1415] >>> largerLst(nlst3) [1.1, 3.75, 10] >>> nlst3 [1.1, 0.75, 2, 3.75, 1.5, 10, 3.1415]

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

python help, please show all steps and include comments

  1. Write a function largerLst() that takes a list of numbers (i.e., int or float values) as a parameter and returns a new list constructed out of it. The list returned has all the values in the parameter list that are larger than the element immediately to their right, that is, larger than their right neighbor. If the parameter list is empty or there are no values larger than their right neighbor, then the function returns an empty list. Note that the last element in the list will never be included in the list returned since it does not have a right neighbor. The function should not change the parameter list in any way. Note that a correct solution to this problem must use an indexed loop That is, one that makes a call to the range() function to generate indices into the list which are used to solve the problem (Review lecture notes 8-1). A solution that does not use an indexed loop will not be accepted. Note in particular that you are not allowed to use the index() or find() methods of the list class. Don’t forget to include the docstring and comments. Copy and paste or screen shot the code and the eight test cases shown below in your submission.

    

>>> largerLst([31]) # test with only one item

[]

>>> largerLst([]) # test empty list

[]

>>> nlst1 = [1,3.3,5,7.7,9] # assign a list to a variable name

>>> largerLst(nlst1) # use the list name in the function

[]

>>> nlst1

[1, 3.3, 5, 7.7, 9] # display the list to show that it was not modified

>>> nlst2 = [-3.5,4,-1.5,8,0,17.7,10]

>>> largerLst(nlst2)

[4, 8, 17.7]

>>> nlst2

[-3.5, 4, -1.5, 8, 0, 17.7, 10]

>>> nlst3 = [1.1,0.75,2,3.75,1.5,10,3.1415]

>>> largerLst(nlst3)

[1.1, 3.75, 10]

>>> nlst3

[1.1, 0.75, 2, 3.75, 1.5, 10, 3.1415]

Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Linked List Representation
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY