Create a custom python module

Assignment Help C/C++ Programming
Reference no: EM131292368 , Length: 2

Part -1:

- 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

Part -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.

1. Write a program named program61.py that enables the user to enter any number of course names and percent grades and write them to a file named grades.txt. Pressing Enter when prompted for a course name should end user input and print "File was created and closed" See sample run below in which 4 course names were entered, but note that more or fewer courses could have been entered.
SAMPLE RUN
Enter course or Enter to quit math
Enter percent achieved 88
Enter course or Enter to quit comm
Enter percent achieved 93
Enter course or Enter to quit chem
Enter percent achieved 80
Enter course or Enter to quit ethics
Enter percent achieved 96
Enter course or Enter to quit
File was created and closed

2. Write another program named program62.py that reads grades.txt. The program should output all of the course names and scores on file, one course per line as shown below. The overall average score should be calculated and displayed accurate to two decimal places.
SAMPLE RUN
Here are your grades
math score is 88
comm score is 93
chem score is 80
ethics score is 96
Average grade score is 89.25

Reference no: EM131292368

Questions Cloud

What lessons we can take from the japanese experience : What lessons we can take from the Confucian/Japanese experience that might contribute to a better social experience in our culture and to the improvement of ourselves as individuals.
Target had beginning inventory : Target had beginning inventory equal to 1,000 and ending inventory equal to 2000. COGS was equal to 6,000. What was Target’s days to sell? The answer is 91 days but could you please give a detailed solution of how that is calculated?
Accounts payable reflects accounts with inventory suppliers : The following information was taken from the 2012 annual report of Bed Bath & Beyond, a leading house hold retailer (dollars in thousand): Assume that accounts payable reflects only accounts with inventory suppliers, and compute the cash payments mad..
Analyze major components of agencys human resource system : Analyze three to four of the major components of the agency's human resource system, processes, and performance evaluation plan for hiring and retaining a diversified workforce.
Create a custom python module : 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 - Create a custom Python module named tempconvert.py. This module must contain two functions: one that c..
What is the companys net income and selling : A company has revenue of $18,000; COGS of $8,000. Operating income of $4,000; Income before tax of $4,000; Tax expense of $500. What is the company’s net income and Selling, General & Admin expense? The answer is $ 6000 and $ 3500 respectively but co..
What role is played by government : What role is played by government?· Identify and analyze current trends in healthcare, including information technology, biotechnology, smart phones, health informatics, and other relevant technologies in the context of the overall US heal..
Stockholders equity section of the balance sheet : Bramble Corporation’s adjusted trial balance contained the following accounts at December 31, 2017: Retained Earnings $127,100, Common Stock $764,000, Bonds Payable $100,000, Paid-in Capital in Excess of Par-Common Stock $200,700, Goodwill $56,300, A..
Abandoned or brought under control : Why does it often take a long time before troubled projects are abandoned or brought under control?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Implement function types that takes no input

Implement function types that takes no input, declares 3 variables of type char, 3 of type short, 3 of type int, and 3 of type double.

  The size ofthe character array holding your filename

How to express for code "THE SIZE OF THE CHARACTER ARRAY HOLDING YOUR FILENAME >=1024 (or use strings), we need to use long file names when grading your code."

  Prepare a program that uses at least two functions that can

prepare a program that uses at least two functions that can be called from your main. this program is a number game

  Write and test c program which outputs waveform

Write and test a C program which outputs waveform which switches from 10.0 kHz with a 50% duty cycle to 25.0 kHz with a 5% duty cycle every 5 seconds.

  The two major modifications are the instruction of pointers

the two major modifications are the instruction of pointers and the calculation of mortgage interest rates.requirements

  Give a divide and conquer algorithm for the problem

Give a divide and conquer algorithm for the same problem that takes time theta(log(n)).

  Write a program that requires the number of bits

Write a program that requires the number of bits for the exponent and significant of a floating point representation, then requires two decimal real numbers and an operation, sum, subtraction or multiplication.

  Write an algorithm to compute the volume of water

Write an algorithm to compute the volume of water in cubic feet, flowing through a pipe of diameter d in feet, with a velocity of v feet per second.

  Prototypes would work for the function called func

Consider the following: int anArray[3][5] =

  Write a program to read data from input file

Write a program to read data from input file.  The first value read is the number of numbers to be read next.  Calculate average of those numbers and write to an output file the numbers read and the average.  Repeat this process until end of file. Us..

  Write the definition of the non parameterized constructor

Write the definition of the Non parameterized constructor (constructor1) so that the private member variables are initialized to 0. Write the definition of the parameterized constructor (constructor 2) so that the private member variable x is initial..

  Write the definition of a void function

Write the definition of a void function that takes as input two parameters of type int, say sum and testScore. The function updates the value of sum by adding the value of testScore. The new value of sum is reflected in the calling environment.

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