tommy_txj
tommy_txj
全部文章
分类
归档
标签
去牛客网
登录
/
注册
tommy_txj的博客
全部文章
(共25篇)
题解 | #字符串排序#
while True: # 反复使用可执行程序,所以外部加while循环 try: c=input() # 输入一个字符串 c1 = [a for a in c if a.isalpha()] # 获取该字符串中所有的字母记录在列中 c1 =...
2022-12-15
0
265
题解 | #删除字符串中出现次数最少的字符#
c=input() # 输入一个字符串 # 构造词典 d {a':2, 'b':3,'c':2} d = {} for each in c: if each not in d: d[each]=1 else: d[each]+=1 # 根据词典d将...
2022-12-15
0
233
题解 | #字符串排序#
n=int(input()) # 主要是第一次输入可以获取之后一共多少个input。。 box=[] for i in range(n): box.append(input()) box = sorted(box) # 上述每个输入形成列,这里对列里的字符排序按照A-Z默认 for eac...
2022-12-15
0
210
题解 | #计算某字符出现次数#
def cal(sentence,word): sentence = sentence.lower() # 统一小写(空格和数字在str.lower()作用下不变) word = word.lower() #统一小写 words = [ a for a in sentenc...
2022-12-14
0
0
题解 | #字符串最后一个单词的长度#
def cal(a_sting): word = a_string.split(' ')[-1] return len(word) in_ = input() out_ = cal(in_) print(out_)
2022-12-14
0
201
首页
上一页
1
2
3
下一页
末页