Q14Numerical3 Marks28 Apr 2024
strings.txt is a text file whose contents are given below:
1a
2b
3c
4d
5e
6f
7g
What is the output of the following snippet of code? Enter an integer as your answer.
f = open('strings.txt', 'r')
count = 0
```
f = open('strings.txt', 'r')
count = 0
for line in f:
line = line.strip()
for char in line:
try:
x = int(char)
except ValueError:
count += 1
f.close()
print(count)
```
Press Enter to check.