Advertisement
sigmachto

Untitled

Jul 4th, 2023
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.80 KB | None | 0 0
  1.  
  2. #1)
  3. def f(n):
  4.     a = {}
  5.     for i in range(len(n)):
  6.         a[n[i]] = n[i]
  7.     return a
  8. n = [x for x in input().split()]
  9. print(f(n))
  10.  
  11.  
  12.  
  13. # 2)
  14. def f(n):
  15.     a = {}
  16.     for i in range(1, n + 1):
  17.         a[i] = i ** 2
  18.     return a
  19.  
  20.  
  21. print(f(int(input())))
  22.  
  23. # 3)
  24. a = {'data1': 375, 'data2': 567, 'data3': -37, 'data4': 21}
  25. s = 1
  26. for i in a:
  27.     s *= a[i]
  28. print(s)
  29. #Ответ: -165209625
  30.  
  31.  
  32. #4)
  33. a  = {',','.',';',':','?','!'}
  34. count = 0
  35. s = input()
  36. for i in range(len(s)):
  37.     if s[i] in a:
  38.         count += 1
  39. print(count)
  40. #Ответ: 1
  41. #5)
  42. a = {'0','1','2','3','4','5','6','7','8','9'}
  43. b = []
  44. s = input()
  45. for i in range(len(s)):
  46.     if s[i] in a:
  47.         b.append(s[i])
  48. if len(b) >= 1:
  49.    s = set(b)
  50.    b = list(s)
  51.    b.sort()
  52.    print(*b,sep='')
  53.  
  54. else:
  55.     print('NO')
  56.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement