解题思路:
字符串的 strip(), split(), upper() 方法;列表的 count() 方法;格式化输出。
参考代码:
s = input().strip().split() word = [] L = 0 for i in range(len(s)): s[i] = s[i].strip('.') s[i] = s[i].strip(',') s[i] = s[i].upper() if s[i] not in word: word.append(s[i]) L = max([len(i) for i in word]) for i in word: num = s.count(i) print('{1:>{0:}}:'.format(L, i)+'*'*num+str(num))
0.0分
1 人评分
C语言程序设计教程(第三版)课后习题8.8 (C++代码)浏览:551 |
C语言程序设计教程(第三版)课后习题10.7 (C语言代码)浏览:644 |
C语言程序设计教程(第三版)课后习题6.11 (C++代码)(有个库函数叫sqrt)浏览:864 |
点我有惊喜!你懂得!浏览:1238 |
Hello, world! (C语言代码)浏览:1201 |
C语言训练-数字母 (C语言代码)浏览:585 |
【出圈】 (C语言代码)浏览:558 |
1126题解浏览:594 |
字符逆序 (C语言代码)浏览:509 |
班级人数 (C语言代码)浏览:926 |