-7

Count the number of periods (.) there are in the file.

Use the built-in function count() on the file after you have converted it to a string.

Answer with the result as an integer.

I've no idea to do this..please help!

Ara192
  • 21
  • 1
  • 6

1 Answers1

2

try as follow

with open('file.txt') as f:
    file_content = f.read()

result = file_content.count('.')

result will be the number of periods.

Francesco Nazzaro
  • 2,688
  • 11
  • 20