The programming language to use here is not stated, so standard output is not clear. A solution using text boxes for input and output can be given in Delphi:
unit Unit2;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type TForm2 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
procedure FormCreate(Sender: TObject);
private { Private declarations }
public { Public declarations }
end;
var Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.FormCreate(Sender: TObject);
var i: integer;
txtline: string;
begin
i := StrToInt(edit1.text);
txtline := IntToStr(i) + ', ' + IntToStr(2 * i) + ', ' + IntToStr(i * i); edit2.text := txtline;
end;
end.
Answer:
The solution code is written in Python:
- def nested_list_string(list2D):
- output = ""
- for i in range(0, len(list2D)):
- for j in range(0, len(list2D[i])):
- output += str(list2D[i][j]) + " "
-
- 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)
Answer:
A. Helps to quickly find information in a document
B. Points readers to specific page numbers
D. Locates specific sections within a document