Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def how_even(list):
- temp = 0
- for num in list:
- if num % 2 == 0:
- temp += 1
- return temp
- test = [12, 54, 765, 354, 22, 433, 678, 854, 56, 211, 11, 101, 69]
- print(how_even(test))
- def unic(list):
- temp = []
- for i in list:
- if temp.count(i) == 0:
- temp.append(i)
- return temp
- temp = [1, 1, 1, 1, 1, 3, 43, 43, 4, 3, 4, 9, 6, 7, 9, 7, 9, 5, 5, 5, 78, 9, 9, 9, 78, 6, 66, 6]
- print(unic(temp))
- def letter(poem):
- ans = {}
- for l in poem:
- if l not in tuple(ans.keys()):
- ans[l] = 1
- else:
- ans[l] += 1
- return ans
- poem = "Зайку бросила хозяйка — Под дождем остался зайка. Со скамейки слезть не мог, Весь до ниточки промок."
- rez = letter(poem)
- print("В строке %s:" % poem)
- for key in list(rez.keys()):
- print(f"{rez[key]} символов {key}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement