Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Python please answer questions P6.3 & P6.4 (HW15 & 16) Programming Exercises 331 .P6.3 multiples of 2 (but not 2), multiples of 3 (but

image text in transcribed
Using Python please answer questions P6.3 & P6.4
(HW15 & 16)
Programming Exercises 331 .P6.3 multiples of 2 (but not 2), multiples of 3 (but not 3), and so on, up to the multiples of 100. Print the remaining Write a program that adds all numbers from 2 to 10,000 to a list. Then remove the values. . P6.4 Write li P64 Write list functions that carry out the following tasks for alist of integers. For each function, provide a test program. a. Swap the first and last elements in the list. b. Shift all elements by one to the right and move the last element into the first position. For example, 1 49 16 25 would be transformed into 2514916. c. Replace all even elements with O d. Replace each element except the first and last by the larger of its two neighbors. e. Remove the middle element if the list le e Remove the middle elementif the list length is odd, or the middle two elements if the length is even. f. Move all even elements to the front, oherwise preserving the order of the f. Move all even elements to the front, otherwise preserving elements. g. Return the second-largest element in the list h. Return true if the list is currently sorted in increasing order i. Return true if the list contains two adjacent duplicate elements i. Return true if the list contains duplicate elements (which need not be adjacent). P6.5 Modify the largest, py program in Section 6.3 to mark both the smallest and the larg- est elements P6.6 Write a function sunwithout Smallest that computes the sum of a list of values, except for the smallest one, in a single loop. In the loop, update the sum and the smallest value. After the loop, return the difference. P6.7 Write a function removeMin that removes the minimum value from a list without using the min function or remove method. P6.8 Compute the alternating sam of all elements in a list. For example, if your program reads the input 1 4 9 16 974 9 11 then it computes 1-49-16+9-7+4-9+11--2 P6.9 Write a function that reverses the sequence of elements in a list. For example, if you call the function with the list 149 16 974 9 11 then the list is changed to 11 947 9 16 9 4 1 P6-10 Write a function that implements the algorithm, developed in Section 6.6. P6.11 Write a function def equals(a, b) that checks whether two lists have the P6.12 Write a function ve the same elements in the same order def saneSet (a, b)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions

Question

what is the most common cause of preterm birth in twin pregnancies?

Answered: 1 week ago

Question

Which diagnostic test is most commonly used to confirm PROM?

Answered: 1 week ago

Question

What is the hallmark clinical feature of a molar pregnancy?

Answered: 1 week ago