From 207d129b2b8c832e1e3b799b78a09989869589b1 Mon Sep 17 00:00:00 2001 From: Ronald Martinez Date: Tue, 20 Nov 2012 01:42:29 -0500 Subject: [PATCH] ok --- index.py | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/index.py b/index.py index f78c027..530ad34 100644 --- a/index.py +++ b/index.py @@ -187,44 +187,38 @@ def problem_10(): input = input.read().split('\n')[:-1] n = 8 - - def output2(op): - new_phase = '' - - for x in op: - if x == ' ': - new_phase += ' ' - elif x == '+': - new_phase += x - else: - new_phase += '*' - - return new_phase + chr = '*' phase = '' phase1 = input[random.randint(0, len(input) - 1)] - phase1 = 'macdo nald' - phase_original = 'macdo nald' + phase_original = phase1 + + #print 'phase_original: %s' % phase_original while 0 < n: + n -= 1 + if phase in phase1: - phase1 = phase1.replace(phase, '*' * len(phase)) + phase1 = phase1.replace(phase, chr * len(phase)) output = '' for y, x in enumerate(phase1): - if x == '*': + if x == chr: output += phase_original[y] elif x == ' ': output += ' ' else: - output += '*' + output += chr if output == phase_original: + print 'excelent' break - - n -= 1 + else: + if n == 0: + print 'so bad' + break print 'phase: %s' % output phase = raw_input('Enter phase: ') -- 2.1.1