Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Question:

Create a new Python program (you choose the filename) that contains a main function and another function named change_list. Refer to the SAMPLE OUTPUT after reading the following requirements.

In the main function:

  • create an empty list.
  • use a for loop to add 12 random integers, all ranging from 50 to 100, to the list.
  • use second for loop to iterate over the list and display all elements on one line separated by a single space.
  • display the 4th element, the element at index 9, and the smallest element.
  • call the change_list function with your list as its sole argument.

In the change_list function:

  • use a slice to make a new list from the list that was passed into this function. The new list should hold the middle 6 elements of the list that was passed in. NOTE: you must accomplish this step with a slice.
  • use a function to determine the size of the new list. Print the size.
  • sort the new list in ascending order and return the sorted list to main.

Back in the main function:

  • assign the list returned by change_list to a new list.
  • use another for loop to iterate over this returned list and display all elements on one line, separated by a single space.

SAMPLE OUTPUT

Here is the list of random integers...
99 66 57 81 75 59 58 74 56 90 75 65 
The 4th element in the list is 81
The element at index 9 is 90
The smallest element in the list is 56
The size of the list is now 6
change_list returned this sorted list...
56 58 59 74 75 81

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92525278
  • Price:- $10

Priced at Now at $10, Verified Solution

Have any Question?


Related Questions in Computer Engineering

According to the same national collegiate athletic

According to the same National Collegiate Athletic Association data, the means and standard deviations of eligibility and retention rates (based on a 1,000-point scale) for the 2013-2014 academic year are presented, alon ...

What is the various security architectures which provides

What is the various security architectures. Which provides the best balance between simplicity and security? Justify your answer.

Iq test scores of students are normally distributed with

IQ test scores of students are normally distributed with mean μ=100 and standard deviation σ=10. What is the 33th percentile of the IQ scores? For a randomly chosen student, what is the probability that his or her IQ sco ...

Question interface design guidelines please respond to the

Question: "Interface Design Guidelines" Please respond to the following: • Imagine you are leading a team of designers for a new software product. During the kickoff meeting, the team starts to discuss design guidelines. ...

Remember all of the following steps when showing that a

Remember all of the following steps when showing that a problem D is NPcomplete: 1. Show that D is in NP by briefly explaining how to quickly verify a solution to it. 2. Choose another problem Q that is known to be NP-ha ...

Question we are running the insertion sort algorithm on the

Question : We are running the Insertion Sort algorithm on the array A = . a) Write the array A at the start of the iteration j=5 of the for loop. b) What is the value of i at the start of the iteration j=6 of the for loo ...

Social sitessocial media is a common marketing tool and

Social Sites Social media is a common marketing tool and most site builders offer integration with major social media sites. Discuss at least two examples of what you would promote on social media from a web site that yo ...

Software design processquestion what are the best practices

Software Design Process Question: What are the best practices in writing program? Describe each one briefly. Noe: This question needs to be research. The book may all of the beat practice listing.

1 define organizational communication2 what interesting

1. Define organizational communication 2. What interesting about the subject of organizational communication

Question suppose 4 packets of a message each of l bits

Question : Suppose 4 packets of a message, each of L bits arrive at a switch (router) and traverse a link with rate R bps to the destination. Further, suppose that the link is free when the first packet arrives, and the ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As