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
The name for the instructions you write to a computer in a program
aliina [53]

Answer:

Code

Explanation:

The code is instructions that you can write yourself or download from online

4 0
2 years ago
Read 2 more answers
Different network scenarios require the
Vladimir [108]

Answer:

a) Viruses

Explanation:

Vulnerability assessment is performed by variety of tools and these can be protocol analyzer, vulnerability scanner, Honeypots, port scanners, honey nets and banner grabbing tools.

Port scanners : they are used to scan the ports which can be exploited by attackers. Most of TCP/IP applications communicate using different ports and attackers can exploit these ports if they are found vulnerable. for example : ports like 80 and 443 are commonly used for HTTP and SSL communication. 22 is used for SSH and if they are open to world then it will allow attackers to use those to get the entry into the system.

Protocol Analyzers : They are used to analyze the packet captures. tools like wireshark, tshark, these tools will help user to decode HTTP/SSL/HTTPS/FTP/RSTP or any application protocols communication. this will help user to understand any unwanted or non-anticipated traffic.

Vulnerability Scanners : They are used to detect the vulnerabilities in the network or systems. these will help administrators to get the alerts whenever there are unanticipated activity. It will have two types of scanners one is active scanner and other is passive scanner. Active scanners will keep on sending probes at the fixed time slots and passibe scanners will be in listening mode all the time. These scanners will alert when a new nodes comes up or goes down or if any system gets compromised.

Honeypots and Honey nets : They are devices or softwares which are having limited security. These devices are made vulnerable purposefully so that attackers can try and attack.  This will help softwares to detect the attackers when they try to exploit these open vulnerabilities. They are deceptions created with purpose.

Banner grabbing Tools : These are tools which will capture the banner information like HTTP protocol version, underlying operating system, open ssl versions being used, server software and similar information. these are important as it will open up potential vulnerabilities in the underlying software. for ex : SSLv3 has a vulnerability known to world and can be exploited by anyone.

4 0
2 years ago
Give four examples of devices which are both<br>Input and Output to a Computer.​
myrzilka [38]

Answer:

HDMI ,I only have one answer to this question

4 0
3 years ago
Jason needs to design the colors for a web site that make it easy to read. Which should he consider using?
Umnica [9.8K]

Answer:

a. Contrasting background and text

Explanation:

3 0
3 years ago
Read 2 more answers
a particular variety of database that works by connecting tables to each other. It is the most popular form of database and the
NeTakaya

Answer:

Relational Database      

Explanation:

  • Relational Database is the type of database in which data is stored and presented in the form of tables and it is used to access, manipulate and manage data.
  • Table is also called a relation. It consists of rows and columns where rows represent a record of data and columns represent the attributes of the data.
  • Every table has a primary key which uniquely identifies a row in a table and a foreign key is used to establish relationships among tables.
  • In relational database domain is used to define specify the possible values that an attribute can have.
  • Constraints can also be applied to the values of the attributes in the table.
  • There are many advantages of a relational database.
  • It can organize and manage bulk of information.
  • It is easy to add or delete data in the relational database according to the change in requirements.
  • Relational database ensures the consistency and integrity of data when many users obtain the same database at same time by using concurrency control methods.
  • It ensures security by limiting access rights to the data.
  • It also eliminates data redundancy and dependency using normalization technique which ensures data integrity and accuracy.
3 0
3 years ago
Other questions:
  • Which of the following is an example of a problem that could be attributed to poor ergonomics?
    10·1 answer
  • The analog signals that carry analog or digital data comprise composites built from combinations of simple sine waves.
    12·1 answer
  • With network management software, a network manager can ____.
    6·1 answer
  • Ladders are a fundamental piece of equipment on construction sites and employers are expected to ensure that workers follow safe
    5·1 answer
  • Two technicians are discussing a parasitic load test. Technician A says that the parasitic load is measured with an ammeter Tech
    13·1 answer
  • What can you use on Code.org's Web Lab to find and fix problems when you are writing code for your website?
    13·1 answer
  • पुजवय<br>शब्दस्य<br>विरूदायक​
    7·1 answer
  • By limiting the number of times a person can use a type of software before registering as the authorized owner of that software,
    15·1 answer
  • The math function ceil(x) returns the smallest integer that is greater than or equal to x. True False
    12·1 answer
  • Acquiring new knowledge and skills at every stage of life:
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!