#NoPayJan Offer - Access all CloudxLab Courses for free between 1st to 31st Jan
We can search in the file line by line or by creating a single string for the whole content of the file.
check = 0 with open("/cxldata/python_sample_file") as f: for line in f: if(line.startswith('w')): check = check + 1
startswith function checks if the string is starting with the argument mentioned in the brackets.
startswith
Basically, here were searching for the lines in the file which are starting with 'w'.
'w'
Can you tell the value of check after the above code is executed?
No hints are availble for this assesment
Answer is not availble for this assesment
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...