Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #1)
- def f(n):
- a = {}
- for i in range(len(n)):
- a[n[i]] = n[i]
- return a
- n = [x for x in input().split()]
- print(f(n))
- # 2)
- def f(n):
- a = {}
- for i in range(1, n + 1):
- a[i] = i ** 2
- return a
- print(f(int(input())))
- # 3)
- a = {'data1': 375, 'data2': 567, 'data3': -37, 'data4': 21}
- s = 1
- for i in a:
- s *= a[i]
- print(s)
- #Ответ: -165209625
- #4)
- a = {',','.',';',':','?','!'}
- count = 0
- s = input()
- for i in range(len(s)):
- if s[i] in a:
- count += 1
- print(count)
- #Ответ: 1
- #5)
- a = {'0','1','2','3','4','5','6','7','8','9'}
- b = []
- s = input()
- for i in range(len(s)):
- if s[i] in a:
- b.append(s[i])
- if len(b) >= 1:
- s = set(b)
- b = list(s)
- b.sort()
- print(*b,sep='')
- else:
- print('NO')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement