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
11Alexandr11 [23.1K]
3 years ago
12

Input numbers and segregate them by placing their values into even or odd vectors based upon their value being even or odd. Then

fill a 2-D array with the first column containing the contents of the even vector and the second column containing the odd vector. Output the result and display the contents of the vectors and array.
Computers and Technology
1 answer:
dedylja [7]3 years ago
7 0

Answer:

The solution code is written in Python

  1. input_numbers = [5, 7, 1, 12, 9, 34, 22, 97, 112]
  2. evenVec = []
  3. oddVec = []
  4. for x in input_numbers:
  5.    if x % 2 == 0:
  6.        evenVec.append(x)
  7.    else:
  8.        oddVec.append(x)
  9. num2D = [evenVec, oddVec]
  10. print(num2D)

Explanation:

Let's create a sample input numbers that mixed with odd and even values (Line 1)

Next, create evenVec and oddVec variables to hold the even and odd numbers from the input_numbers (Line 3 - 4).

Create a for-loop to traverse through the input_numbers and check if current number, x, is divisible by 2 using the modulus operator %. If so, x % 2 will be evaluated to 0 and append the current x to evenVec or else append to oddVec (Line 6 - 10).

Next, create a variable num2D to hold the two dimensional arrays with first column is evenVec and second column is oddVec (Line 12).

When printing the num2D (Line 14), we shall get

[[12, 34, 22, 112], [5, 7, 1, 9, 97]]

You might be interested in
Find the area of square whose perimeter is 260.8m​
inessss [21]
4251.04

The perimeter (260.8) over 4 is equal to each side length (65.2)

65.2^2 = 4251.04
5 0
3 years ago
The User Datagram Protocol (UDP) is called the connectionless protocol because: It does not attempt to fix bad packets but resen
DochEvi [55]

Answer:

The User Datagram Protocol (UDP) is called the connectionless protocol because:

It does not attempt to fix bad packets or resend lost packets.

Explanation:

Ports are openings or entrance doors through which data packages have access to a PC or server.  TCP and UDP are transport protocols with port numbers.  TCP means Transmission Control Protocol.  They are used to connect two devices over the internet and other networks.  UDP means User Datagram Protocol.  They are used to connect applications and to speed the transfer of data.  Comparatively, UDP is faster, simpler, and more efficient than TCP.  TCP enables retransmission of lost data packets, which UDP cannot do.

4 0
3 years ago
A security team has downloaded a public database of the largest collection of password dumps on the Internet. This collection co
Scorpion4ik [409]

Answer:

a. Password length, password encryption, password complexity

Explanation:

Under this scenario, the best combination would be Password length, password encryption, password complexity. This is because the main security problem is with the user's passwords. Increasing the password length and password complexity makes it nearly impossible for individuals to simply guess the password and gain access, while also making it extremely difficult and time consuming for hackers to use software to discover the password as well. Password excryption would be an extra layer of security as it encrypts the password before storing it into the database, therefore preventing eavesdroppers from seeing the password and leaked info from being used without decryption.

4 0
3 years ago
Who would like to join a team devoted to decreasing spam and bullying?
Tema [17]
Yes i would love to help the cause <span />
6 0
3 years ago
The capacity of a communication channel is measured in _______.
PSYCHO15rus [73]
<span>The capacity of a communication channel is measured in gb and gps.</span>
4 0
3 years ago
Read 2 more answers
Other questions:
  • Sushant is a new manager and he wants to share his ideas and working protocol with his team.Compare the advantages and disadvant
    13·1 answer
  • Please Help!! Digital Information Technology Class!!
    12·2 answers
  • 6. A distribution consists of three components with frequencies 200, 250 and 300 having means
    14·1 answer
  • What is the full form of bcc please tell​
    15·2 answers
  • HELP! ASAP I KNOW IT'S QUITE A HANDFUL BUT I NEED THIS ANSWER!!
    10·1 answer
  • What type of photography is represented by a photograph of a dog on a beach ?
    11·1 answer
  • it says i have brainly plus subscripton but whenever i log onto brainly using my laptop, it says i don't have brainly plus and w
    12·1 answer
  • You attempt to telnet to system 192.168.1.240. You receive the following message: "Connecting To 192.168.1.240...Could not open
    5·1 answer
  • 40 points
    5·2 answers
  • Budgeting for a Computer
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!