Choose descriptive variable names in all programs

Assignment Help C/C++ Programming
Reference no: EM131297707 , Length:

Chapter

- Add more comments as needed in each program to explain what your code is doing.
- Choose descriptive variable names in all programs.
- Before submitting this assignment, refer to the grading rubric to maximize your earned grade points.

1. Write a program named program71.py as follows. Follow instructions carefully to avoid point deductions.
In the main function:
- create an empty list named nums.
- use a loop to add 10 random integers, all in the range from 1-25, to the list.
- use another loop to display the numbers all on the same line, separated by a single space.
- sort the list.
- use another loop to display the sorted numbers all on the same line, separated by a single space.
- make a new list named start by slicing out the first 4 elements of the sorted nums list.
- print the start list.
- make a new list named finish by slicing out the final 5 elements of the sorted nums list.
- print the finish list.
- execute the odd_even function (defined next) with sorted nums as its sole argument.
Inside the odd_even function:
- process the list and output the number of even and odd elements.
- display the 6th element in the list.
Sample Output
10 11 10 18 23 3 11 25 23 15
3 10 10 11 11 15 18 23 23 25
[3, 10, 10, 11]
[15, 18, 23, 23, 25]
List had 3 evens and 7 odds
The 6th element in sorted nums is 15

Verified Expert

It generates list of 10 random number from 1 to 25. After that it sorts the list. it generates two more lists from starting and ending of first list. After this, program calculate the number of even and odd numbers. it display the 6th number from list.

Reference no: EM131297707

Questions Cloud

How might california''s lorenz curve change : Does the median voter theory explain voters' rejection? If California lowers the highest tax rate to below the current 10.5 percent and cuts some free benefits, how might California's Lorenz curve change?
Discuss about the question of law given below : Discuss about the Question given below:David enters into a contract to buy 440 acres from Hollis to expand David's ranch. Hollis breaches the contract. David's normal remedy is (Indicate your choice and offer 1-2 sentences to explain your choice):
Analysis of leadership topic : For this assignment, compose a critical analysis of a journal article found in the Saudi Electronic University Library regarding a leadership topic. If possible, find a topic that is related to the Middle East.
Which of maslows hierarchy of needs are not satisfied : Which of Maslow's hierarchy of needs are satisfied by employment at CHC? Which of Maslow's hierarchy of needs are not satisfied by employment at CHC?
Choose descriptive variable names in all programs : Write a program named program71.py as follows. Follow instructions carefully to avoid point deductions - use another loop to display the numbers all on the same line, separated by a single space.
What is the bond capital gain or loss yield : A 30-year, 10% semiannual coupon bond with a par value of $1,000 may be called in 4 years at a call price of $1,100. What is the bond's yield to maturity? What is the bond's current yield? What is the bond's capital gain or loss yield?
A brief overview of game theory : The "Prisoner's Dilemma" was the gateway to the strategic viewpoint of game theory. In this assignment, you will explore the applications of game theory to economic business decisions.
Define in your words what a leader is : 1) In your opinion, which of these types of leadership is most effective in gaining greater influence on a company's employees and thus achieving their operational goals? Justify your answer. (Charismatic, visionary and transformational). 2) De..
Explain how chcs performance may increase : A health club differs from manufacturing firms in that it produces a service rather than products. Would a manufacturing firm satisfy Maslow's hierarchy of needs more easily than service firms?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Using virtual methods, organize the animals

Using virtual methods, organize the animals in a small zoo, having as guests lions, parrots, alligators, penguins, elephants, cobras, zebras, hawks, turkeys and rabbits.

  Prepare a linear support vector machine svm

Write a computer program to prepare a Linear Support Vector Machine SVM

  A company hired 10 temporary workers

A company hired 10 temporary workers who are paid hourly and you are given a data file that contains the last name of the employees, the number of hours each employee worked in a week, and the hourly pay rate of each employee.

  Bare in mind this is a program

Bare in mind this is a program with the audience being lawncare and landscaping people. So the events will generally be to know how often a client wants their lawn mowed.

  Sentinel security product prototype description

Sentinel Security Product Prototype Description - The paper should describe innovative aspects of your product and persuade the stakeholders of the intrinsic value of your product.

  Write function to find whether number is perfect number

Write down the function perfect which determines whether number is perfect number or not. This function must receive number and return true if number is perfect.

  Write a menu driven program for an online beef

Write a menu driven program for an online beef distribution company. There are 8 different

  Write a program that contains a main function

Write a program that contains a main function and three other functions that will return various attribute information about an array of floating point

  Creating a part number

Write C++ program that asks a user to enter a part number to order. The rules for creating a part number are as follows:

  Write in c++. read an inputfile.txt

write in C++.  read an inputFile.txt which contains integers that are virutal addresses, and I am suppossed to translate that into physical addresses using a page table and a transition lookaside buffer

  Arithmetic instructions and a branch instruction

A computer system is using pentium-5 processor with 5 stages in pipeline processing with cycle time of 5ns, whereas another computer system is using pentium-7 processor with 7 stages in pipeline processing with cycle time of 3.75 ns.

  Two types of constructors

Explain what constructors do and when they are executed. Explain the two types of constructors. Provide an example class that includes both types of constructor functions and demonstrate how an object would be instantiated using both types of constru..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd