This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Greatest common divisor | |
# Наибольший общий делитель | |
a, b = 16, 17 | |
while b != 0: | |
# temp = a | |
# a = b | |
# b = temp % b | |
a, b = b, a%b | |
print(a) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import time | |
# Time before running program | |
start = time() | |
# for i ...: ... | |
# Time after program done | |
print('Time', time() - start) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fake_useragent import UserAgent | |
def get_html(url): | |
response = requests.get(url, headers={'User-Agent': UserAgent().chrome}) | |
return response.text | |
# Результат UserAgent().chrome: | |
# 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.15 (KHTML, like Gecko) Chrome/24.0.1295.0 Safari/537.15' |
NewerOlder