ss=input("请输入字符串:") while ss != 'exit': #3 n=0 for x in ss: if 'A'<=x<='Z': #4 n=n+1 #3 print('大写字母数量为:',n) ss=input("请输入字符串:")