题目内容

Problem 1CFrom Problem 1B, what should the new line be?______

查看答案
更多问题

Problem 1AWhat line of code should we add at Line 4 to solve this problem? Mark all that apply:

A. except:
B. except IOError:
C. except ValueError as e:
D. except FileNotFound:
E. except IOError as e:

Problem 1BSecondly, we have decided that we want to split our words up by commas instead of spaces.What line should we change to solve this problem?Line Number:______

In the loop, we need to make sure we ignore all lines that don't contain the relevant data. Be sure that you have looked through the raw data file and that you understand which lines do and do not contain relevant data.Which set of conditions would capture all non-data lines (ie, provide a filter that would catch anything that wasn't relevant data)? fields is defined as it was in Question 2 - that is, fields is the variable that contains a list of elements in a line.

A. if len(fields) != 3:
B. if len(fields) != 3 or 'Boston' == fields[0] or 'Day' == fields[0]:
C. if '-' == fields[0] or 'Boston' == fields[0] or 'Day' == fields[0]:
D. if '-' == fields[0] or 'Boston' == fields[0] or 'Day' == fields[0] or ' ' == fields[0]:
E. if len(fields) < 3 or not fields[0].isdigit():
F. if not fields[0].isdigit() or len(fields) < 3:

Once the file is open, we'll parse the data line by line.After initializing two empty lists to hold the high and low temperatures, you'll want to loop through the lines of the file and split up each line into words (each line will be a string).Write the line of code which splits a line line into a list of elements by spaces and stores the result in a variable called fields.______

答案查题题库