Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assignment Requirements 1. Write a single program named listplay.py as follows.

ID: 655904 • Letter: A

Question

Assignment Requirements

1. Write a single program named listplay.py as follows. Using methods not described below will result in point deductions.

In the main function:

create an empty list named nums.

use a loop (type of your own choosing) to add seven integers, each in the range 20 to 80, to nums. Duplicates are okay.

use a second loop to display the seven integers all on one line separated by a single space. This second loop must be a while loop.

display the largest integer in the list.

display the smallest integer in the list.

call a void function named process that takes a slice made from nums as an argument. This slice should be missing the first and last elements of nums.

In the process function:

display the elements in the slice all on one line separated by a single space and sorted in highest to lowest order.

You must use a for loop in process. The elements should NOT be displayed inside [ ] separated by commas.

Example Output
79 30 39 33 41 43 53
The highest number is 79
The lowest number is 30
The middle 5 sorted high to low:
43 41 39 33 30

Explanation / Answer


#include<iostream>
main()
{
int array[7][1];
   rows=7;
   cols=1;
cout<<" enter the element ";
for(int i=0;i<=rows;i++)
   {
   for(int j=0;j<=cols;j++);
   {
   while(a[i][j]>20 &&a[i][j]<=80)
       {
       cin>>array[i][j];
       }
   }
itemg=a[0][0];
iteml=a[7][1];
for(int i=0;i<=rows;i++)
   {
   for(int j=0;j<=cols;j++);
   {
   if(itemg<=a[i][j])
   {
   itemg=a[i][j];
   }
   if(iteml>= a[i][j])
       {
       iteml=a[i][j];
       }
   }
}
cout<<"greatest element is :"<<itemg;
cout<<"lowest element is:"<<iteml;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote