Question: Write the function is _ valid _ line _ data ( line _ data _ tuple ) that returns True if all the values in

Write the function is_valid_line_data(line_data_tuple) that returns True if all the values in the data tuple are valid; otherwise it returns False.
Note:
Data values are valid if, and only if, they are not -1 or '-1'. That is,-1 and '-1' are considered to be invalid.
You must include all your code for part 2 so far.
Your is_valid_line_data function will typically be used to process the data generated by your data_tuple_from_line function.
You must include your working data_tuple_from_line function - some tests will call it.
Your function must be general enough to handle any number of values in the data tuple.
That is, we will test it with different length tuples.
For example:
Test Result
line = 'SCE-INT-500025441,2011-09-23,4.48,35175,4094,90254,Hermosa Beach,CA'
data_tuple = data_tuple_from_line(line)
result = is_valid_line_data(data_tuple)
print(result)
True
line = 'SCE-INT-500671284,2015-03-26,7.206122449,-1,0,92241,DESERT HOT SPRINGS,CA'
data_tuple = data_tuple_from_line(line)
result = is_valid_line_data(data_tuple)
print(result)
False
data =('SCE-INT-500671284','2015-03-26',7.206122449)
result = is_valid_line_data(data)
print(result)
True

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!