What's wrong with this lvl4- python code?
Hi guys,
I'm trying to solve lvl 4, and I'm pretty sure i'm on the right way
but there might be some bug on my code?
Anyways here is my code:
What is wrong with it?
Thanks in advance[/code]
I'm trying to solve lvl 4, and I'm pretty sure i'm on the right way
but there might be some bug on my code?
Anyways here is my code:
- Code:
OpenTheFile = open("ToTranslate.txt","r")
ReadIt = OpenTheFile.read()
Counter=0
LastChar="a"
WasLast=0
for Charac in ReadIt:
Temp = ord(Charac)
if (Temp >= ord("a")) and (Temp <= ord("z")):
if Counter==3:
LastChar=Charac
WasLast=1
Counter=0
else:
Counter=0
elif (Temp >= ord("A")) and (Temp <= ord("Z")):
Counter=Counter+1
if Counter>3:
Counter=0
WasLast=0
elif Counter==3 and WasLast==1:
print LastChar,
WasLast=0
Counter=0
What is wrong with it?
Thanks in advance[/code]

