Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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.



Write a one-liner that will count the number of capital letters in a file. Your code should work eve..

Answer / 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

More Python Interview Questions

What is tail recursion?

0 Answers  


How do I run a python script?

0 Answers  


What is a dataframe in python?

0 Answers  


What is the difference between a shallow copy and deep copy?

0 Answers  


What is lambda?

0 Answers  


Explain all the file processing modes supported by python?

0 Answers  


How long can an identifier be in python?

0 Answers  


Is python object oriented?

0 Answers  


What is a function for flatten an irregular list of lists?

0 Answers  


Why is numpy so fast?

0 Answers  


How to find the index of an item given a list containing it in python?

0 Answers  


Explain how to make Forms in python.

1 Answers  


Categories