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
PLEASE HELP ME ASAP I HAVE AN EXAM SOON!!!!
3241004551 [841]

Answer:

try seeing if the nozzle of the cartridge is clogged

Explanation:

8 0
3 years ago
Where is permanent data in the computer stored? Whenever Jim starts his laptop, he sees some commands and numbers appearing on h
Wittaler [7]

the operating system ithink

4 0
4 years ago
A material systems developer typically combines the skills of a programmer with the multitasking expectations of a
shusha [124]

Explanation:

Material systems developer typically combines the skills of a programmer with the multitasking expectations of developing 3 dimensional models of objects, enhancing the graphical effects.

don't delete my answer this time i try to help ppl

3 0
3 years ago
The school has determined that finding the absolute best schedule cannot be solved in a reasonable time. Instead they have decid
Anettt [7]

Answer:

i dont know what to say

Explanation:

... speechlessss

4 0
3 years ago
A structure is private by default, but can be declared to be friend or private.
posledela
Structures can be accessed from anywhere within the module or class in which they are declared. A structure is Friend by default. To specify the accessibility in more detail, include Public, Protected, Friend, Protected Friend, or Private in the Structure statement. You must declare every data member of a structure.
4 0
3 years ago
Other questions:
  • Sizing handles are used in Microsoft® Word® to _____.
    13·1 answer
  • Input numbers and segregate them by placing their values into even or odd vectors based upon their value being even or odd. Then
    12·1 answer
  • Write a single if-test using Boolean operators and relaional operators to determine if a double variable x is between zero (excl
    11·1 answer
  • We need ____ pointers to build a linked list.
    6·1 answer
  • Within a Microsoft Windows environment, who has access rights to the Encrypting File System (EFS) features and functions?
    7·1 answer
  • Of the measures of feasibility in the accompanying figure, ____ considers points such as "Does the proposed platform have suffic
    8·1 answer
  • Roark has just joined a company and in his role as a lead analyst, he will be responsible for determining which systems developm
    11·1 answer
  • What are the five Ws?<br> (I don’t even know what this means)
    5·2 answers
  • window operating system popularly known as. 1) character user interface. 2) computer user interface. 3) graphic user interface.
    15·1 answer
  • (10 points) Make a user interface to get 3 points from the user which will be placed on the coordinate plane. Then write a Pytho
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!