Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Q: 1. Write a program that read a sequence of positive integer inputs and print the sum and average of the inputs. Assume that the user always enters a positive number (integer) as an input value or an empty space as a sentinel value. Please use the below to test your code:

Enter an int value or empty string to end: 98

Enter an int value or empty string to end: 78

Enter an int value or empty string to end: 77

Enter an int value or empty string to end: 1

Enter an int value or empty string to end: 10

Enter an int value or empty string to end:

Sum: 264 Average: 52.8

2. Write a program that read a sequence of positive integers and print the number of odd inputs entered by the user. The sentinel value is an empty string. Use the following test case :

Enter integer or empty string to end: 3

Enter integer or empty string to end: 2

Enter integer or empty string to end: 10

Enter integer or empty string to end: 5

Enter integer or empty string to end: 6

Enter integer or empty string to end: 7

Enter integer or empty string to end:

number of odd integers entered: 3

3. Write a program that read a sequence of positive integers and print the average value of all the odd integers entered by the user (hint: you need to compute the sum of all the odd integers first to calculate the average). Use the following test case:

Enter an int value or empty string to end: 10

Enter an int value or empty string to end: 20

Enter an int value or empty string to end: 5

Enter an int value or empty string to end: 10

Enter an int value or empty string to end: 15

Enter an int value or empty string to end:

average : 10.0

Use python code for all questions and give the outpu in word document and make in python cell file

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M93102461

Have any Question?


Related Questions in Computer Engineering

1 what is the purpose of exclusive gates such as the xor

1. What is the purpose of exclusive gates such as the XOR and XNOR? 2. What function do these gates perform?

Suppose that we want to convert the small computer into a

Suppose that we want to convert the small computer into a 16- bit RISC type of processor (address and data buses are both 16-bits wide and each instruction is supposed to occupy 16 bits in the instruction memory). If the ...

Suppose there are two links between a source and a

Suppose there are two links between a source and a destination. The first link has transmission rate 200 Mbps and the second link has transmission rate 15 Mbps. Assuming, that the only traffic in the network comes from t ...

Using a telephone survey of 400 randomly selected

Using a telephone survey of 400 randomly selected registered voters, he solicits both their party identification and whether or not they had read the newspaper that day. The results are displayed in the following cross-t ...

Question you recently joined a local cyber security hackers

Question: You recently joined a local cyber security "hackers" group that meets once a month to discuss recent cyber security related events, as well as tools and techniques. You have offered to present at the next meeti ...

Suppose you are given a six-sided die that might be biased

Suppose you are given a six-sided die, that might be biased in an unknown way. Explain how to use die rolls to generate unbiased coin flips, and determine the expected number of die rolls until a coin flip is generated. ...

Recommend a mechanism that will record event data on the

Recommend a mechanism that will record event data on the folders for each department. What events should be logged and how often do these logs need to be reviewed? Recommend an implementation for antivirus software. Sugg ...

Question suppose user process application p1 of one

Question : Suppose user process (application) P1 of one computer wishes to transfer data (file) to process (application) P2 on another computer in the Internet. What addressing information about P2 is necessary for P1 to ...

Margaret moore wants to invest in four-year bonds that are

Margaret Moore wants to invest in four-year bonds that are currently priced at $863.49. These bonds have a coupon rate of 5.1 percent and make semiannual coupon payments. What is the current market yield on this bond? (R ...

Answer the following question whats the difference between

Answer the following Question : What's the difference between public, protected, and private members? What's the difference between static binding and dynamic binding?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As