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
GuDViN [60]
4 years ago
6

Define a function below called nested_list_string. The function should take a single argument, a list of lists of numbers. Compl

ete the function so that it returns a string representation of the 2D grid of numbers. The representation should put each nested list on its own row. For example, given the input [[1,2,3], [4,5,6]] your function should produce the following string: "1 2 3 \n4 5 6 \n" Hint: You will likely need two for loops.
Computers and Technology
1 answer:
DerKrebs [107]4 years ago
8 0

Answer:

The solution code is written in Python:

  1. def nested_list_string(list2D):
  2.    output = ""
  3.    for i in range(0, len(list2D)):
  4.        for j in range(0, len(list2D[i])):
  5.            output += str(list2D[i][j]) + " "
  6.    
  7.    return output  

Explanation:

Let's create a function and name it as nested_list_string() with one input parameter, list2D (Line 1).

Since our expected final output is a string of number and therefore we define a variable, <em>output</em>, to hold the string (Line 2).

Next use two for loops to traverse every number in the list and convert each of the number to string using <em>str()</em> method. Join each of individual string number to the output (Line 3-5).

At the end, we return the output (Line 7)

You might be interested in
Which engineer may design a GPS for a vehicle?
Crank

Explanation:

Mechanical engineer may design a gps for a vehicle.

4 0
3 years ago
What best compares potrait and landscape orientations
REY [17]
In portrait  the height is taller than its wide and in landscape the height is smaller than wide
so its the wider and taller
5 0
3 years ago
Beth accidentally clicked Send on a message that was addressed to multiple recipients. She wants to use the recall option. Which
yKpoI14uk [10]

Answer:

External users will be able to access the message.

Explanation:

When dealing with the internal email system of an enterprise, it's possible to do a recall on the message.  If someone on the internal list didn't open the message yet, it will simply be deleted from his queue and it will appear as is that email never existed.

For external users, once the email has been sent, it cannot be recalled... so they'll be able to access it no matter what, because that email exists on an external server on which you have no management control.

3 0
3 years ago
I GOT A 65% LAST TIME AND IM DOING RETAKE! PLEASE DONT FAIL ME THIS TIME
yawa3891 [41]

Answer:

Explanation: c vecause am pro

4 0
3 years ago
Read 2 more answers
Write an expression using membership operators that prints "Special number" if special_num is one of the special numbers stored
Mashcka [7]

Answer:

In python, the statement can be written as:

<em>if(special_num in special_list): print("Special Number") </em>

Explanation:

We need to create a list with the name 'special_list' with some values and then check whether special_num is in the list or not using the membership operator.

Membership operator in python: <em>in</em>

Let us do it step by step in python:

<em>special_list = ['1', '2', '3','4']      #</em>A list with the values 1, 2, 3 and 4

<em>special_num = input("Enter the number to be checked as special \t") </em>

<em>#</em>Taking the input from the user in the variable special_num.

<em>if(special_num </em><em>in</em><em> special_list): print("Special Number") </em>

#Using the membership operator <em>in </em>to check whether it exists in the list or not.

Please refer to the image attached for the execution of above program.

So, the answer is:

In python, the statement can be written as:

<em>if(special_num in special_list): print("Special Number") </em>

6 0
4 years ago
Other questions:
  • On the home ribbon, what do you use to change the font size of characters in a cell
    9·1 answer
  • Under which tab can you find the options for reusing slides from other presentations
    5·1 answer
  • Where would be the most likely place to find the keyboard combination used to toggle a keyboard backlight on or off?
    8·1 answer
  • A(n) _______ allows an attacker to use a network structure to send large volumes of packets to a victim.
    5·1 answer
  • ? Assessment
    10·1 answer
  • A ________ is a dummy function that is called instead of the actual function it represents, to test that the call to and return
    8·1 answer
  • Anybody know this? Read the following scenario. Using complete sentences, explain which part of the CIA triad has been broken. M
    11·1 answer
  • List six common raster image file types.
    9·1 answer
  • Answer this pls ASAP
    11·1 answer
  • A company Digicom Parts manufactures 2 types of unique products for laptop and desktop computers. It manufactures 10 types of la
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!