Complete the code to display the first 5 lines of a file named 'data.txt'.
head -[1] data.txtThe head command shows the first lines of a file. Using -5 shows the first 5 lines.
Complete the command to find lines containing the word 'error' in 'log.txt'.
grep [1] log.txtThe grep command searches for text. Using 'error' finds lines with that word.
Fix the error in the command to count lines in 'file.txt'.
wc -l [1]The wc -l command counts lines. The filename must be given plainly without extra dashes.
Fill both blanks to create a dictionary of word lengths for words longer than 3 letters in a list.
{word: [1] for word in words if len(word) [2] 3}This dictionary comprehension maps each word to its length only if the word is longer than 3 letters.
Fill all three blanks to create a dictionary with uppercase keys and values greater than 0.
result = [1]: [2] for k, v in data.items() if v [3] 0}
This comprehension creates a dictionary with keys in uppercase and includes only items where the value is greater than zero.