Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 1번
- def solution(A):
- for num in A:
- if A.count(num) > (len(A)//2):
- return A.index(num)
- return None
- # 2번
- def palindrome(string):
- ls = []
- for i in range(len(string)):
- if string[i].isalpha():
- ls.append(string[i])
- for i in range(len(ls)):
- if ls[i] != ls[-(i+1)]:
- return False
- return True
- print(palindrome("ABBA"))
- print(palindrome("ABBAC"))
- print(palindrome("ABB#A"))
- print(palindrome("ABB#C"))
Add Comment
Please, Sign In to add comment