+ 2
Security Code Coach
Im currently working on the Security Code Coach challenge… But I only manage to pass cases 1, 2 and 4 Heres my code: https://code.sololearn.com/cJB5QwxUVDwZ/?ref=app (Please dont just post the solution)
3 Respostas
+ 1
One situation:
When $ is first position, it fails because nearestLower is undefined..
+ 1
Jayakrishna🇮🇳 Oh I overlooked that… Thanks! 😀
+ 1
code = input()
strip_x = [letter for letter in code if letter != "x"]
code_dict = {}
for lt in strip_x:
code_dict[lt] = strip_x.index(lt)
if code_dict['T'] == code_dict['#x27;] + 1 or code_dict['T'] == code_dict['#x27;] - 1:
print("ALARM")
else:
print("quiet")