Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M Ricardo, Susan D Urban

3rd Edition

1284056945, 9781284056945

Students also viewed these Databases questions