Your code should work even if the file is too big to fit in memory.
for i in string : (i.isupper()) : count = count + 1
string is the input which is taken from the user.
isupper() is a function which checks whether the alphabet is uppercase or not.
Count is a variable which increments itself whenever it finds an upper case alphabet.