Attachment '2012-11-09.cifry.py'

Download

   1 #!/usr/bin/env python
   2 # coding: utf
   3 '''
   4 В заданной строке найти длину самой длинной последовательности цифр
   5 '''
   6 
   7 string = raw_input("Введите строку с цифрами: ")
   8 digits = "0123456789"
   9 count, maxcount = 0, 0
  10 for c in string+" ":    # В конце строки должна быть не цифра
  11     if c in digits:
  12         count += 1
  13     else:
  14         if maxcount < count:
  15             maxcount = count
  16         count = 0
  17 
  18 print maxcount

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.

You are not allowed to attach a file to this page.