-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e0da738
commit ecbc971
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -*- coding: utf-8 -*- | ||
# UTF-8 encoding when using korean | ||
|
||
def solution(password): | ||
length = len(password) | ||
for i in range(length - 2): | ||
first_check = ord(password[i + 1]) - ord(password[i]) | ||
second_check = ord(password[i + 2]) - ord(password[i + 1]) | ||
if first_check == second_check and (first_check == 1 or first_check == -1): | ||
return False | ||
return True | ||
|
||
|
||
password1 = "cospro890" | ||
ret1 = solution(password1) | ||
|
||
print("solution 함수의 반환 값은", ret1, "입니다.") | ||
|
||
password2 = "cba323" | ||
ret2 = solution(password2) | ||
|
||
print("solution 함수의 반환 값은", ret2, "입니다.") |