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

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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