Write a one-liner that will count the number of capital letters in a file. Your code should work even if the file is too big to fit in memory.
Answer Posted / mahesh
len([c for l in open('foo.txt') for c in l if c.isupper()])
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How does ternary operator work in python?
Why is not__getattr__invoked when attr==’__str__’?
What is __ doc __ in python?
What is frozen set in python 3?
How to retrieve data from a table in mysql database through python code?
Difference between python list comprehension vs. Map?
Explain about cookies in python?
Can you sort a dictionary python?
What does the continue do in python?
What is decorator in python?
How is numpy different from scipy?
What does [::-1} do?
What are the benefits of using python? What do you understand of pep 8?
What is hierarchical inheritance?
What are python variables?