Facebook
From Wiktor, 5 Years ago, written in Python.
Embed
Download Paste or View Raw
Hits: 235
  1. #1
  2.  
  3. def czyPalindrom(napis):
  4.  
  5.     return napis == napis[::-1]
  6.  
  7.  
  8.  
  9. #2
  10.  
  11. def czyAnagram(napis_1, napis_2):
  12.  
  13.     napis_1_bez_spacji = napis_1.replace(" ","")
  14.     napis_2_bez_spacji = napis_2.replace(" ","")
  15.     n_1 = list(napis_1_bez_spacji)
  16.     n_2 = list(napis_2_bez_spacji)
  17.     n_1.sort()
  18.     n_2.sort()
  19.    
  20.     if n_1 == n_2:
  21.         return True
  22.     else:
  23.         return False
  24.  
  25.  
  26.  
  27. # 3
  28.  
  29. def moda(lista):
  30.  
  31.     return max(set(lista), key = lista.count)