1. 给出一个字符串,在程序中赋初值为一个句子,例如comment=“To improve is to change;to be perfect is to change often.” 需要:计算句子中各字符出现的次数

      1. set1=set(comment)
      2. for i in set1:
      3. print(i,'共出现',comment.count(i),'次')
      1. dict={}
      2. for i in comment:
      3. dict[i]=comment.count(i)
      4. for key in dict:
      5. print(key,dict[key])
      1. i=0
      2. dicta ={}
      3. while i < len(comment):
      4. dicta.update({comment[i]:comment.count(comment[i])})
      5. i+=1
      6. for k,v in dicta.items():
      7. print(f'{k}一共出现了{v}次')
      1. count={}
      2. for i in comment:
      3. count.setdefault(i,0)
      4. count[i]=count[i]+1
      5. print(count)
    2. 生成100个卡号,具体要求如下: —-1. 卡号以6102009开头, 后面3位依次是 (001, 002, 003…… 100) —-2. 生成关于银行卡号的字典, 默认每个卡号的初始密码为”redhat”;