Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # n = int(input('Введите число для которого нужно посчитать факториал\n'))
- # fact = 1
- # for i in range(1, n + 1):
- # fact *=i
- # print(fact)
- # while n !=0
- # fact = 1
- # for i in range(1, n + 1):
- # fact *= i
- # print(fact)
- # n = int(input('Введите число для которого нужно посчитать факториал\n'))
- # while n !=0:
- # factorial = lambda x: factorial(x-1) * x if x > 1 else 1
- # print(factorial(n))
- # n = int(input('Введите число для которого нужно посчитать факториал\n'))
- # import numpy as np
- #
- # matrix = [[1,0,0,1,0],
- # [0,1,0,1,0],
- # [1,0,0,1,0],
- # [0,0,0,0,0]]
- # print(np.matrix(matrix))
- # print("\n")
- # matrix_t = list(zip(*matrix))
- # print(np.matrix(matrix_t))
- from urllib.request import urlopen
- # {key1: value1, key2: value2, ...}
- u = urlopen('http://python.org')
- words = {}
- for line in u:
- line = line.decode('utf-8')
- line = line.strip(' \n')
- for word in line.split(' '):
- try:
- words[word] += 1
- except KeyError:
- words[word] = 1
- pairs = words.items()
- A = sorted(pairs, key=lambda x: x[1], reverse=True)
- for i in A[:10]:
- print(i[0], i[1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement