From 767b3a735a7f17ab682a9946d7775a6539b893c0 Mon Sep 17 00:00:00 2001 From: Ronald Martinez Date: Tue, 20 Nov 2012 01:25:50 -0500 Subject: [PATCH] ok --- index.py | 75 ++++++++++++++++------------------------------------------------ 1 file changed, 19 insertions(+), 56 deletions(-) diff --git a/index.py b/index.py index fd32260..f78c027 100644 --- a/index.py +++ b/index.py @@ -188,8 +188,9 @@ def problem_10(): n = 8 - def output(op): - new_phase = '' + def output2(op): + new_phase = '' + for x in op: if x == ' ': new_phase += ' ' @@ -200,71 +201,33 @@ def problem_10(): return new_phase - - phase = ' ' + phase = '' phase1 = input[random.randint(0, len(input) - 1)] - phase1 = 'mac do' - - """ - xphase = '' - for x in phase1: - if x == ' ': - xphase += ' ' - else: - xphase += '*' - #phase1 = xphase - - print phase1, xphase - """ + phase1 = 'macdo nald' + phase_original = 'macdo nald' while 0 < n: if phase in phase1: - phase1 = phase1.replace('', ' ').replace(phase, '+' * len(phase)) + phase1 = phase1.replace(phase, '*' * len(phase)) - _output = output(phase1) + output = '' + for y, x in enumerate(phase1): - #print _output + if x == '*': + output += phase_original[y] + elif x == ' ': + output += ' ' + else: + output += '*' - n -= 1 + if output == phase_original: + break - """ - if phase in phase1: - print 'xxx' - phase1 = xphase.replace(phase, len(phase) * '*') - """ + n -= 1 - print 'phase: %s' % _output + print 'phase: %s' % output phase = raw_input('Enter phase: ') - - """ - if phase in phase1: - - print 'cccc' - phase1 = phase - return - """ - sys.stdout.write(os.popen('clear').read()) problem_10() - - - - -""" -i = ronald martinez - -i. -o = ------+-------- - -print o - -if phase in i: - - i = i.replace(phase, '+') -ro -""" - - - -- 1.8.5.2