Chat with us, powered by LiveChat python program | WriteDemy

Question Description

  • Write a function to complete each of the following tasks. Test the function with a test driver.
    1. Function name: compareSum which receives the reference to a tuple with 15 elements. Compute the sum of the first 5 elements and the sum of the last 5 elements. If the sum of the first 5 elements is larger than that of the last 5 elements, print the message “Sum of first five elements is larger.” If the sum of the first 5 elements is the same as that of the last 5 elements, print the message “No difference.” Otherwise, print the message “Sum of first five elements is smaller.”
    2. Function name: printEvenIndex which receives the reference to a tuple with 15 elements. Return the index of those elements which are even integers.
    3. Function name: printThirdIndex which receives the reference to a tuple with 15 elements. Return the index of the third integer which is greater than 3.
    4. Function name: calculateAverage which receives the reference to a tuple with 15 elements. Return the average of the integers stored in the tuple.
    5. Function name: calculatePercent which receives the reference to a tuple with 15 elements. Return the percent of those elements whose indexes are not divisible by 3 or 4.
    6. Function name: countAboveAverage which receives the reference to a tuple with 15 elements. Return the number of elements which are greater than the average of the integers in the tuple.
    7. Function name: calculateRange which receives the reference to a tuple with 15 elements. Return the range of the integers stored in the tuple. The range is defined as the difference between the largest integer and the smallest integer in the tuple.
  1. Write a function named addPositive which has one parameters: numbers (a tuple consisting of integers). The function returns the sum of positive integers stored in the tuple.
  2. Write a function named findIndex which has two parameters: a tuple of integers named numbers and k (a positive integer). The function returns the location of the first integer in the tuple which is less than k. If none of the element in the tuple is less than k, the function returns -9.
  3. Write a function named findSecondLargest which has one parameter: numbers (a tuple containing distinct integers). The function returns the second largest value in the tuple.
  4. Write a function named shiftRight which accepts a list of integers named numbers. The function shifts elements to the right by one position and the last one to the front. That is, numbers[0] → numbers[1], numbers[1] → numbers[2], …, numbers[size-2] → numbers[size-1], and numbers[size-1] → numbers[0], where size is the number of elements in the list. Print the original list and the new one to check to see if the list elements are shifted down correctly.
  5. Write a function named exchange which accepts an list of integers named numbers. The function exchanges elements in the following manner: numbers[0] is exchanged with numbers[size-1], numbers[1] is exchanged with numbers[size-2], number[2] is exchanged with numbers[size-3], etc., where size is the number of elements in the list.
  6. Write a function named isLarger which has two parameters: first and second (both are tuples of integers). The function returns a 1 if the largest value in the first tuple is larger than the largest value in the second tuple; it returns 0 if both largest values are the same; it returns -1 if the largest value i

Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.

Do you need an answer to this or any other questions?

About Writedemy

We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.

How It Works

To make an Order you only need to click on “Place Order” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Are there Discounts?

All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.

Hire a tutor today CLICK HERE to make your first order