From stachi, 2 Years ago, written in Python.
Embed
Hits: 182
1. #PotÄ™ga
4.         return podstawa
6.         return 1
8.     stageOne = (podstawa**half)*(podstawa**half)
10.         return stageOne
11.     else:
12.         return stageOne*podstawa
13.
14. print("3^7 = " + str(sprytne_potegowanie(3, 7)))
15.
16.
17. #Anagram
18. def czyAnagram(x,y):
19.     word1=[]
20.     word2=[]
21.     for letter1 in x:
22.         if letter1 == " ":
23.             continue
24.         else:
25.             word1.append(letter1.lower())
26.     for letter2 in y:
27.         if letter2 == " ":
28.             continue
29.         else:
30.             word2.append(letter2.lower())
31.     word1.sort()
32.     word2.sort()
33.     if word1==word2:
34.         return 'Anagram'
35.     else:
36.         return 'Nie anagram'
37.
38. print(czyAnagram('I am Lord Voldemort','Tom Marvolo Riddle'))
39.
40. #Palindorn 1
41.
42. def czyPalindron1(slowo1):
43.      reverse = slowo1[::-1]
44.      if slowo1 == reverse:
45.          return True
46.      else:
47.          return False
48.
49. print(czyPalindron1('kobyla'))
50.
51. #Palindorn 2
52.
53. def czyPalindron2(slowo2):
54.      list = []
55.      for s in slowo2:
56.          list.append(s)
57.      list.reverse()
58.      list = ''.join(list)
59.      if slowo2 == str(list):
60.          return True
61.      else:
62.          return False
63.
64. print(czyPalindron2('kobyla'))
65.
66. #moda
67.
68. def moda(y):
69.     higest = 0
70.     higestNumber =set()
71.     for number in y:
72.         temp = y.count(number)
73.         if higest <= temp:
74.             higest = temp