#unicode for characters target = [105, 111, 100, 106, 106, 100, 126, 118, 107, 108, 105, 119, 98, 101, 124, 98, 119, 107, 117, 104, 104, 128] def transform(c): return ord(c) + 3 def check(password): if len(password) != len(target): return False for i, c in enumerate(password): if transform(c) != target[i]: return False return True while True: pw = input("Ange lösenord: ") if check(pw): print("Rätt!") break else: print("Fel, försök igen.\n")