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
How do you access the dark web? What are the negatives of doing this?
Inessa05 [86]
The dark web is illegal and therefore people can hack you, obtain your information (identity theft) etc.
6 0
3 years ago
. Write a statement that throws an IllgalArgumentException with the error message Argument cannot be negative.
dybincka [34]

Answer:

public class PostAccount

{

  public void withdraw(float savings)

  {

     if (savings >=0 )

     {

        IllegalArgumentException exception

              = new IllegalArgumentException("Savings cannot be negative");

        throw exception;

     }

     balance = savings - withdraw;

  }

 }

Explanation:

IllgalArgumentException is a type of NumberFormatException  of runtime exception. Here in the program we have created an object of IllgalArgumentException class and after that we have thrown the error to show the condition if it does not satisfy the if condition.

8 0
3 years ago
What can Marla enter into cell A11 to find out how much money is left in her budget and to make sure the cell is updated wheneve
Nookie1986 [14]
Personally I have my budget spreadsheet with all of my expenses in columns. Then I have a column showing my estimated paycheck (updating with actual# later).  Then the formula in the "Remaining" column that I use is this:    sum((A1:A99)-A100)  Where A1 through A99 (or whatever# of expenses you have) and -A100 or whatever cell name your paycheck/money is entered into - and that's all I do.  I actually have a 3 year budget, including birthdays, holidays, vacations, etc. so that you can plan ahead for any expenses and save away any extra.
8 0
3 years ago
Write an if statement to test if a number stored in y is between 6 and 10 inclusive.
lana66690 [7]

y = choose whatever number you want.

if 5 < y < 11:

   print("The value stored in y is between 6 and 10 inclusive")

else:

   print("The value stored in y is not between 6 and 10 inclusive.")

I hope this helps!

8 0
3 years ago
Anthony is responsible for tuning his organization's intrusion detection system. He notices that the system reports an intrusion
Alinara [238K]

The errror that has occured is a False Positive error.

Explanation:

  • A false positive is where you receive a positive result for a test, when you should have received a negative results.
  • A false positive (type I error) — when you reject a true null hypothesis.
  • The type I error rate or significance level is the probability of rejecting the null hypothesis given that it is true. It is denoted by the Greek letter  alpha
3 0
3 years ago
Other questions:
  • In a relational database design, all relationships are expressed by ________.
    10·1 answer
  • What is the value of this expression?
    6·1 answer
  • Explain why the 7 bit standard ASCII code needs to have the highest bit set to a zero
    11·1 answer
  • What's is the contribution of technology to the country?
    15·1 answer
  • is the process of creating a message to be communicated. a. Encoding b. Decoding c. Receiving d. Sending
    10·2 answers
  • Computer is created by aliens?!
    14·1 answer
  • What are ways to enter formula in Excel? Check all that apply
    8·2 answers
  • Which of the following is an example of an access object?
    9·1 answer
  • Who is Mr.Anonymous?
    5·2 answers
  • The current annual interest rate is 5 percent, and you are taking out a 20-year loan with a monthly end-of-month payment. If you
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!