Disk blocks allocated to a file are added to the free list when the file is deleted. Write an algorithm to perform this operation in Unix. code example
Example 1: Try out the enumerate function for yourself in this quick exercise. Complete the skip_elements function to return every other element from the list, this time using the enumerate function to check if an element is on an even position or an odd position.
def altElement(a):
return a[::2]
Example 2: You will be passed a file path P and string S on the command line. Output the number of times the string S appears in the file P.
You will be passed a file path P and string S on the command line. Output the number of times the string S appears in the file P.
file = open(P, 'r')
ptext = file.read()
print(ptext.count(S))
file.close()