G = [7, 8, 5, 67, 21, 54, 1]
Get_sorted_arr(heaphy(G))
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
let = tuple('ABEKMHOPCTXY')
num = tuple('0123456789')
let1 = 0
num1 = 0
num2 = 0
num3 = 0
let2 = 0
let3 = 0
while let1 < 12:
num1 = 0
while num1 < 10:
num2 = 0
while num2 < 10:
num3 = 0
while num3 < 10:
let2 = 0
while let2 < 12:
let3 = 0
while let3 < 12:
print(let[let1], num[num1], num[num2], num[num3], let[let2], let[let3], sep='')
let3 += 1
let2 += 1
num3 += 1
num2 += 1
num1 += 1
let1 += 1
date = "2017-02-16T14:43:42+03:00"
new_date = date.replace("T", " ")
new_date = "-".join(new_date[:10].split("-")[::-1]) + new_date[10:]
print(new_date)
def func(arr):
arr = arr[:]
print(arr)
arr.append(1)
arr_ = [0,0,0]
print('arr_', arr_)
func(arr_)
print('arr_', arr_)
gen_dict = (lambda x=82: dict([(y, y*y) for y in range(x)]))
print(gen_dict())
import json
import random
server_answer = '{"result": [' + str(random.randint(0, 100)) + ']}'
n = json.loads(server_answer)["result"][0]
new_url = f"www.primer.com/{n}"
print(new_url)
server_answer
- это переменная с ответом сервера. weight, moon = 70, 0.165
print("Ваш вес в 2018 году:", weight * moon)
print(*[str(i) + " " + str(round((weight + i-1) * moon, 2)) for i in range(1, 16)], sep="\n")
a = 'test'
b = 'test stroka'
if a in b:
b = "".join(b.split(a))
a = 'test'
b = 'test stroka'
l = [a, b]
if a in b:
b = "".join(b.split(a))
l[1] = b
# -*- coding: utf-8 -*-
# Author: Metalofon
def stab(numbers, last_number=None):
numbers = list(numbers)
if len(numbers) < 1:
return True
number = numbers[0]
if last_number is not None:
if last_number - 1 <= number <= last_number + 1:
return True and stab(numbers[1:], number)
else:
return False
else:
return True and stab(numbers[1:], number)
def add_or_sub(numbers, last_number=None):
numbers = list(numbers)
if len(numbers) < 1:
return []
number = numbers[0]
if last_number is not None:
if last_number < number:
return [1, *add_or_sub(numbers[1:], number)]
else:
return [-1, *add_or_sub(numbers[1:], number)]
else:
return [0, *add_or_sub(numbers[1:], number)]
def stabil(numbers):
result = stab(numbers)
if result:
return "Стабильно"
else:
return "Нестабильно"
def col(numbers):
colbs = sum(add_or_sub(numbers))
if colbs > 0:
return "Рост"
elif colbs < 0:
return "Спад"
else:
return "Колебания"
numbers_m = (
(1, 2, 3, 4, 5),
(5, 4, 3, 2, 1),
(5, 50, 4, 3, 1),
(1, 2, 1, 2, 1),
(2, 1, 2, 1, 2),
(1, 5, 2, 5, 1),
(5, 4, 4, 5, 4)
)
for numbers_n in numbers_m:
print(stabil(numbers_n), col(numbers_n))
def get_n():
try:
number = int(input("Введите число от 0 до 100: "))
if 0 <= number <= 100:
return number
except ValueError:
pass
print("Вы ввели неправильное число!")
return get_n()
def bot(n=0, r=0, d=50):
print(f"Бот пробует число {n}, это его {r} попытка.")
if n == number:
print(f"Бот угадал число, число было {n}, и затратил на это {r} попыток.")
else:
if n < number:
bot(n + d, r + 1, d)
else:
bot(n - d, r + 1, int(d / 2) if int(d / 2) > 0 else 1)
number = get_n()
bot()
bot(n + d, r + 1, d)
bot(n + d, r + 1, d - 1 if d - 1 > 0 else 1)
car = {
'MAN': '777',
'AUDI': '888',
'VOLVO': '999',
'BMW': '000',
}
for key in car:
print(f"{key}")
break
car = {
'MAN': '777',
'AUDI': '888',
'VOLVO': '999',
'BMW': '000',
}
print(list(car.keys())[0])
# .keys - это список ключей.
name = raw_input("What is your name? ")
print("Hello,", name)