Create a custom python module

Assignment Help Basic Computer Science
Reference no: EM131296381

Assignment 1:

- 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

Assignment 2:

- Write all lines of your pseudocode as comments immediately after your name and SPC ID# comment.
- 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,

1. Write a program named program51.py that defines a value-returning function named cuber that returns both the surface area and volume of a cube. A cube is a rectangular prism with all sides equal. Prompt the user to enter the cube's side length from the keyboard in the main function and then call the cuber function. The main function should "catch" the values returned by cuber and display both the surface area and volume accurate to three decimal places.
SAMPLE OUTPUT
Enter side length of cube 2.5
Surface area is 37.500
Volume is 15.625

2. Write a program named program52.py that uses main and a void function named numbers that takes no arguments and does not return anything. The numbers function generates 5 random integers, each greater than 10 and less than 30 (duplicates are okay), and prints them all on one line separated by spaces. A loop is required for this, and the loop should also total up the integers so the sum can be displayed when the loop ends. The main function should call the numbers function.
SAMPLE OUTPUT
12 24 16 21 17
The total is 90

3. Create a custom Python module named tempconvert.py. This module must contain two functions: one that converts from Celsius to Fahrenheit and one that converts from Fahrenheit to Celsius. Write a program named program53.py that imports the tempconvert module. The program should prompt the user to specify the temperature and the scale, and then perform the appropriate conversion accurate to two decimal places.
SAMPLE OUTPUT 1
Enter the temperature to convert 37
Was that input Celsius or Fahrenheit?
Enter C or F C
In Fahrenheit, that is 98.60
SAMPLE OUTPUT 2
Enter the temperature to convert -40
Was that input Celsius or Fahrenheit?
Enter C or F F
In Celsius, that is -40.00

Reference no: EM131296381

Questions Cloud

Life example of how companies can differentiate : Give a practical real life example of how companies can differentiate themselves from the competition.
Reported cost of goods sold : Arcon Inc. had inventory on hand at the beginning of March with a cost of $280. At the end of March, Arcon Inc. reported cost of goods sold of $14600 on the income statement and inventory of $560 on the balance sheet. What was Arcon's cost of purchas..
Compose a letter regarding the death penalty : Compose a letter to your state governor (The state is Mississippi) regarding the death penalty. In this letter, explain your position regarding capital punishment
Amount of net cash flows from operating activities : The accountant for Erica’s Dress Shop prepared the following cash budget. Erica’s desires to maintain a cash cushion of $17,000 at the end of each month. Complete the cash budget by filling in the missing amounts. Determine the amount of net cash flo..
Create a custom python module : Write a program named program53.py that imports the tempconvert module. The program should prompt the user to specify the temperature and the scale, and then perform the appropriate conversion accurate to two decimal places.
Provide facilities for manipulating graphs : For this final project, you will be writing a library package to provide facilities for manipulating graphs, plus two clients that use the package. Get or update the skeleton in the usual way (after committing all current work) git fetch shared
Financial statement analysis to operating indicator analysis : Compare financial statement analysis to operating indicator analysis. In a healthcare setting, is one more useful than the other?
Evaluate three software systems available and pros of each : Circuit Broads: 4000 to 10500 a week depending on their demand. Wire Harness: 1200 to 2800 a week depending on their demand. Evaluate three software systems available and the pros and cons of each.
Reduce the company cash outflow for operating expenses : Merton Manufacturing Company has an opportunity to purchase some technologically advanced equipment that will reduce the company’s cash outflow for operating expenses by $1,289,000 per year. The cost of the equipment is $8,372,133.63. Calculate the i..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Detailed network design proposal

Each Classroom Computer Lab will be on a separate network (i.e., subnet). The Library Computer Lab will be on a separate network, and the Office / Admissions computers will also be on a separate network. Finally, the open-WiFi network should be on..

  What is a field effect transistor

What is a field effect transistor (FET)? Which are the different types of FET's available? Draw the circuit arrangement for obtaining the drain characteristics of a JFET and explain the procedure for obtaining the above characteristic curves. Illu..

  Specific types of security breaches

Keeping information systems secure is a major task, both for information security professionals and everyone who uses a network such as the Internet. Discuss 3 specific types of security breaches that could occur as you use the Internet.

  Part of the hipaa privacy rule

True or Flase. As a patient, your doctor must sign a HIPAA Consent and Release Form to share your ePHI or PHI with insurance providers who pay for your medical bills. This is part of the HIPAA Privacy Rule.

  Which index of dispersion would you choose and why

The CPU times in milliseconds for 11 workloads on a processor are 0.74, 0.43, 0.24, 2.24, 262.08, 8960, 4720, 19740, 7360, 22,440, and 28,560. Which index of central tendency would you choose and why?

  What test automation tools are used in your organization

What test automation tools are used in your organization? Can you classify them using the different areas of automation we described in this chapter?

  What is meant by an external entity in a process model

Define what is meant by an external entity in a process model. How should an external entity

  Which is the best policy while driving

What kind of agent design is necessary to carry out the policy (reflex, model-based, goal-based, or utility-based)?

  Write a program that reads in an integer value

Write a program that reads in an integer value for n and then sums the integers from n to 2*n if n is nonnegative, or from 2*n to n if n is negative. Write the code in two versions: one using only for loops and the other using only while loops.

  Find out product stream temperature and volume

Find out the product stream temperature and volume required to carry out reaction in a CSTR at 50 % conversion in adiabatic mode of operation.

  Odd-length cycle in directed graph by linear-time algorithm

Give a linear-time algorithm to find an odd-length cycle in a directed graph. You may NOT assume that the graph is strongly connected.

  Fibonacci sequence in the child process

Write a C program that generates the Fibonacci sequence in the child process. The number of the sequence will be provided in the command line. For example if 10 is provided, the Fibonacci numbers less than 10 will be output by the child process

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