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
What are the first letters of each of the 3 main colors in javaScript? (seperate with commas)
Oxana [17]

Answer:

R, G, B

Explanation:

Red, Green, Blue

4 0
3 years ago
When you start an online course, what should you do to make sure you have access to college resources
VARVARA [1.3K]

As a student starting an online course, you should explore the college website to make sure you have access to college resources.

<h3>What is an online course?</h3>

An online course can be defined as an education programme that typically involves the process of providing and sharing learning resources (contents) in an organized way over the Internet, so as to allow the students (users) progress in their understanding of a course or topic.

As a student starting an online course, you should do the following to make sure you have access to college resources:

  • Explore the college website.
  • Bookmark links to your course.
  • Search for information with regards to advising, degree requirements, and financial aid.

Read more on online course here: brainly.com/question/14591988

#SPJ1

3 0
2 years ago
The physical components of information technology, which can include the computer itself plus peripherals such as storage device
yarga [219]
The correct answer should be Hardware
8 0
3 years ago
What is the overall objective of an IT risk assessment? To assist IT management in establishing a budget for countermeasures To
QveST [7]
The overall objective of an IT risk assessment is to assist an organization in identifying risks and impacts.<span> The process includes discovering, correcting and preventing security problems.</span>
The IT risk assessment document identifies threats, estimates risks and determines how to manage them.
4 0
3 years ago
Refer to the film, actor, and film_actor tables of the Sakila database. The tables in this lab have the same columns and data ty
julsineya [31]

Using the knowledge of computational language in python it is possible to write a code that organizes film, actor and film and actor at the same time.

<h3>Writting the code:</h3>

<em>SELECT a.last_name, a.first_name, ROUND(AVG(f.length)) AS 'average' </em>

<em>FROM film f </em>

<em>INNER JOIN film_actor fa ON f.film_id = fa.film_id</em>

<em>INNER JOIN actor a ON a.actor_id = fa.actor_id</em>

<em>GROUP BY a.last_name, a.first_name</em>

<em>ORDER BY average DESC, last_name ASC;</em>

See more about python at brainly.com/question/18502436

#SPJ1

5 0
2 years ago
Other questions:
  • For film editors, which task comes last in their workflow pattern?
    12·2 answers
  • How can I get more Gems in the game {Fashion Empire} through a Fire kindle?
    15·2 answers
  • What technological changes at the turn of the twentieth century affected american life?
    6·1 answer
  • Each brochure template produces _____ pages of graphics, business information text boxes, and story boxes.
    15·1 answer
  • A _______________ is software that can guess passwords.
    5·1 answer
  • Which method of accessing FTP has the most limited capabilities?
    9·2 answers
  • Which of the following is the most significant outcome of the formation of the SMPTE?
    6·2 answers
  • What is modularity? Help asap
    9·1 answer
  • What is the correct syntax to take the first five characters from the cell A2 and place it to its right in cell A3? =RIGHT(A3,5)
    5·2 answers
  • What is the most appropriate data type for each of these items?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!