a(1): a=data[3].rstrip() cnt=0 for char in a: if (char=='C'): cnt=cnt+1 print cnt a(2): b=data[1].rstrip() c=data[3].rstrip() cnt=0 for i in range(0, 5): char1=b[i] char2=c[i] if (char1==char2): cnt=cnt+1 print cnt b: see the python script file ex1b.py c: def my_max(nums): largest=nums[0] for x in nums: if x > largest: largest = x return largest