Question: Can I please have some help with these Python questions: QUESTION 1 The following Python code segment uses information supplied in two lists of equal

Can I please have some help with these Python questions:

QUESTION 1

The following Python code segment uses information supplied in two lists of equal length: one list is called names_dataset and contains information relating to peoples' names. The other list is calledbirths_dataset and contains birth years of the people referred to in the names_dataset. The lists can be thought of as parallel lists, where the corresponding elements in both lists at the same index (i.e. position) form a conceptual record.

The code below causes information about each person to be printed, including their title, family name, and birth year in the format:

title> family name> was born in the year birth year>

for example:

Mr. Smith was born in the year 1989.

Which of the following pairs of lists would be valid data sets to be used as described above?

A. Can I please have some help with these Python questions: QUESTION 1
B. Can I please have some help with these Python
C. Can I please have some help with these Python
D. Can I please have some help with these Python
E. Can I please have some help with these Python
F. Can I please have some help with these Python

QUESTION 2:

This is a MULTIPLE ANSWER question, which means you are able to select one or more answers as being correct. Note that this does not necessarily mean that there are multiple correct answers. In any case, select all the answers you believe are correct. (NB: There are no part marks awarded for multiple answer questions.)

Suppose there are two list variables of equal length in Python called first and second, for example:

first = [0, 1, 0, 1, 0, 1] second = [0, 0, 1, 1, 0, 0]

The Python code segment below uses both those lists:

Which of the following code segments has the same purpose as the code above? (CHOOSE MORE THAN ONE ANSWER)

A. The following Python code segment uses information supplied in two lists of

B. Can I please have some help with these Python

C. Can I please have some help with these Python

D. Can I please have some help with these Python

E. Can I please have some help with these Python

QUESTION 3

This is a MULTIPLE ANSWER question, which means you are able to select one or more answers as being correct. Note that this does not necessarily mean that there are multiple correct answers. In any case, select all the answers you believe are correct. (NB: There are no part marks awarded for multiple answer questions.)

The following code is meant to open an existing text file ("notes.txt") and print every character in that file to the screen on a separate line. However, the code currently does not work as required. [Line numbers are added for the sake of reference and should not be interpreted as part of the code.]

Which of the following describe the issue/s with this code which stop/s it from performing the intended function described above? (CHOOSE MORE THAN ONE ANSWER)

A.

It is not possible to iterate over the contents of a file with a for loop.

B.

Line 5 should not be part of the outer loop.

C.

There is no need for the inner loop (from line 3) as the outer loop (from line 2) is iterating over every character of the text file.

D.

The call to the print function on line 4 should not be part of the inner loop.

E.

Line 2 attempts to iterate over text_file which isn't a valid file descriptor. It should instead be: forline in notes.txt.

F.

The outer loop (from line 2) is empty and this is not permitted in Python.

G.

Line 2 should be: for char in text_file, as Python treats every element of a text file as a character.

H.

Both loop headers (lines 2 and 3) use the variable line which is not permitted in Python.

I.

Instead of the call to the print function on line 4, there should be a call to the file write function.

J.

On line 1, the arguments to open are missing quotation marks or inverted commas (i.e., the arguments must both be strings).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!