File tree Expand file tree Collapse file tree 2 files changed +24
-8
lines changed
Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Original file line number Diff line number Diff line change 1- def RunLength (strV ):
1+ def RunLength (str ):
22 mark = 0
33 result = ""
4- for i in range (1 ,len (strV ) ):
5- if strV [i - 1 ] != strV [i ]:
6- result += str (i - mark ) + strV [mark ]
4+ for i in range (1 ,len (str ) + 1 ):
5+ if i == len ( str ) or str [i - 1 ] != str [i ]:
6+ result += "%d%s" % (i - mark , str [mark ])
77 mark = i
88 return result
99
1010
1111# keep this function call here
1212# to see how to enter arguments in Python scroll down
13- print RunLength (raw_input ())
14-
15-
16-
13+ print RunLength (raw_input ())
Original file line number Diff line number Diff line change 1+ def is_Prime (n ):
2+ for i in xrange (3 , int (n ** 0.5 )+ 1 , 2 ):
3+ if n % i == 0 :
4+ return False
5+ return True
6+
7+ def PrimeMover (num ):
8+ count = 1
9+ i = 1
10+ while count < num :
11+ i += 2
12+ if is_Prime (i ):
13+ count += 1
14+ return i
15+
16+
17+ # keep this function call here
18+ # to see how to enter arguments in Python scroll down
19+ print PrimeMover (raw_input ())
You can’t perform that action at this time.
0 commit comments