1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Alexandra [31]
3 years ago
7

Write a program that repeatedly takes integers from the user as long as he

Computers and Technology
1 answer:
Scorpion4ik [409]3 years ago
7 0

Answer:

Written in Python:

evens = 0

odds = 0

oddtotal = 0

eventotal = 0

total = 0

mylst = []

tryag = "Y"

while tryag == "Y" or tryag == "y":

     num = int(input("Input: "))

     mylst.append(num)

     tryag = input("Another Input (Y/y): ")

mylst.sort()

print("Minimum: "+str(mylst[0]))

print("Maximum: "+str(mylst[-1]))

for i in mylst:

     total = total + i

     if i%2 == 0:

           evens = evens + 1

           eventotal = eventotal + i

     else:

           odds = odds + 1

           oddtotal = oddtotal + i

print("Evens: "+str(evens))

print("Odds: "+str(odds))

print("Even Average: "+str(eventotal/evens))

print("Odd Average: "+str(oddtotal/odds))

print("Total Average: "+str(total/(evens+odds)))

Explanation:

The following lines initializes useful variables to 0

evens = 0

odds = 0

oddtotal = 0

eventotal = 0

total = 0

This declares an empty list

mylst = []

tryag = "Y"

This is repeated until user stops the loop by entering strings other than y or Y

while tryag == "Y" or tryag == "y":

This prompts user for input

     num = int(input("Input: "))

User input is appended to the list

     mylst.append(num)

This prompts user to try again the loop

     tryag = input("Another Input (Y/y): ")

This sorts the list from small to large

mylst.sort()

This prints 1. The minimum

print("Minimum: "+str(mylst[0]))

This prints 2. The maximum

print("Maximum: "+str(mylst[-1]))

The following iterates through the list

for i in mylst:

This calculates the total

     total = total + i

This checks for even entry

     if i%2 == 0:

This counts the number of even entries

           evens = evens + 1

This sums the even entries

           eventotal = eventotal + i

     else:

This counts the number of odd entries

           odds = odds + 1

This sums the odd entries

           oddtotal = oddtotal + i

This prints 3. Sum of Even entries

print("Evens: "+str(evens))

This prints 4. Sum of Odd entries

print("Odds: "+str(odds))

This prints 5. Average of Even entries

print("Even Average: "+str(eventotal/evens))

This prints 6. Average of Odd entries

print("Odd Average: "+str(oddtotal/odds))

This prints 7. Total Average

print("Total Average: "+str(total/(evens+odds)))

You might be interested in
If your computer is running slowly, which of the following is most likely to solve the problem?
sleet_krkn [62]

Answer:

Purchase Anti-virus

Explanation:

Delete old files.

clear your temp

update to a ssd

8 0
3 years ago
Which number expresses 6.72 as a fraction in simplest form?<br>​
Ymorist [56]
What are the answer choices
8 0
3 years ago
Which job qualifications are typical for someone who wants to work in Information Support and Services?
Scrat [10]

Information Support and Services job qualifications include occupations related to IT deployment. It requires someone with special technical knowledge of the procedures of software, hardware, and network support. It also involves managing information systems, database management, and providing technical support to multiple users.

3 0
3 years ago
Read 2 more answers
I NEED HELP I'LL GIVE BRAINLEST
VikaD [51]

Answer: True

Explanation: direction can be applied only to animations. direction can be applied only to transitions. direction can be applied to both animations and transitions.

5 0
3 years ago
Read 2 more answers
To access a ___ library, you will need a computer and Internet access.
daser333 [38]

Answer:

To access a digital library, you will need a computer and Internet access.

Explanation:

5 0
3 years ago
Other questions:
  • Small-business owner Marcos set up his Google Ads campaign by thinking of “obvious” keywords off of the top of his head. What's
    15·1 answer
  • You receive a file named Project4.xlsx as an attachment to an email message. What do you expect the file to contain?
    8·1 answer
  • An engineer created three VSANs on the Cisco MDS switch. VSAN 100 is allocated to the marketing department, VSAN 110 is allocate
    10·1 answer
  • JavaBeans are?A special Java classfileServletsAppletsA Special form of JSPNone of Given
    8·1 answer
  • Please find one organization that has recently adopted virtualization and summarize their reasons for taking this approach. What
    12·1 answer
  • According to the presentation, integrity and ethics are particularly important for careers in which of the following pathways?
    5·1 answer
  • ____ 59. Suppose that x and y are int variables, ch is a char variable, and the input is: 4 2 A 12 Choose the values of x, y, an
    7·2 answers
  • Tornado Alley is located in the middle of the United States, extending from Texas up through the Dakotas. The above statement is
    6·1 answer
  • What is used to connect computers to the internet*Audio Ports
    15·2 answers
  • How do you enter the decimal 73 into the computer?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!