华工120吧 关注:20贴子:817
  • 2回复贴,共1
我觉得


694M2014辛巴达-第五...torr
大小:7.59KB下载:1次转存:0次
文件已失效
IP属地:广东1楼2014-10-23 12:53回复
    #count ht number.py
    def number(s):
    #please input the string ,this function will out the number of lettter')
    a=0
    b=0
    c=(len(s)-1)
    for i in range(c):
    char1=s[i]#notice the (i-1) probably is -1 !
    for n in range((i-1)):
    while char1!=s[n] and b<=c:
    if char==s[b]:
    a=a+1
    b=n+1
    print(char+'has '+str(a))
    print()
    print()


    IP属地:广东4楼2015-03-30 00:06
    回复
      # in fact ,the idea is right,but I do not know why the format is wrong,maybe i need
      def count(x):
      c=len(x)
      char=[]
      for n in range((c-1)):
      z=x[n]
      char=char.append(z)
      char1=char
      for n in range((c-1)):
      a=char1.count(char1[n])
      b=char1.index(char1[n])
      if b==n:
      print(str(a)+': '+str(n))
      else:
      print()


      IP属地:广东5楼2015-03-31 08:39
      回复