0
I believe my function works but the challenge itself wont pass the strings as parameters.
https://www.sololearn.com/coach/77?ref=app Security Code Challenge
4 Antworten
+ 2
You have to also call the function as:
secure(input())
+ 1
That worked thank you !
0
def secure(str):
guard = "G"
theif = "T"
cash = "quot;
currentCombo = ''"
alarm = False
for chars in str:
if chars != "x":
currentCombo += chars
positions = [
currentCombo.find(cash),
currentCombo.find(theif)
]
if ((positions[0] - positions[1]) == 1):
alarm = True
elif ((positions[1] - positions[0]) == 1):
alarm = True
if alarm == True:
print("ALARM")
else:
print("quiet")
0
Example : secure("xxxGxx$xxxT") Should return Alarm becuase there is no G between $ and T. G=GUARD $=CASH T=THEIF