+ 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 Answers
+ 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")