Guest User

Untitled

a guest
Dec 14th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. # 1번
  2. def solution(A):
  3. for num in A:
  4. if A.count(num) > (len(A)//2):
  5. return A.index(num)
  6. return None
  7.  
  8.  
  9.  
  10. # 2번
  11. def palindrome(string):
  12. ls = []
  13. for i in range(len(string)):
  14. if string[i].isalpha():
  15. ls.append(string[i])
  16.  
  17. for i in range(len(ls)):
  18. if ls[i] != ls[-(i+1)]:
  19. return False
  20. return True
  21.  
  22. print(palindrome("ABBA"))
  23. print(palindrome("ABBAC"))
  24. print(palindrome("ABB#A"))
  25. print(palindrome("ABB#C"))
Add Comment
Please, Sign In to add comment