from sys import path
print(path)
def uz_shop_view(message: telebot.types.Message) -> None:
if message.location is not None:
lon: float = message.location.longitude
lat: float = message.location.latitude
distance: List[...] = []
for loc in STORES:
result: float = geodesic(
(loc['lons'], loc['lats']), (lon, lat)).meters
distance.append(result)
def botprint(_index):
bot.send_venue(message.chat.id,
STORES[_index]['lons'],
STORES[_index]['lats'],
STORES[_index]['title'],
STORES[_index]['address'])
counter = len(distance)
while counter > 0:
i = distance.index(min(distance))
botprint(i)
distance[i] = 10 ** 100
counter -= 1
elif message.location is None:
bot.reply_to(message, "Отправь местоположение!")
mylist = ['было', 'есть', 'будет']
print('не есть' in mylist)
print('есть' in mylist)
if 'есть' in mylist:
print('я нашел!')
else:
print('я не нашел :(')
data = {'response': [{'id': 111111111, 'first_name': 'name', 'last_name': 'lastname', 'city': {'id': 280, 'title': 'Kharkiv'}}]} response = data['response'] # получаем в переменную response содержимое словаря data по ключу response print(response) # по ключу response там список (в []) response0 = response[0] # получаем нулевой элемент списка в переменную response0 - там опять словарь. print(response0) user_id = response0['id'] first_name = response0['first_name'] last_name = response0['last_name'] city = response0['city'] # тут опять в переменную city попадает словарь, который разбираем ниже. print(user_id, first_name, last_name, city) city_id = city['id'] city_title = city['title'] print(city_id, city_title)
[{'id': 111111111, 'first_name': 'name', 'last_name': 'lastname', 'city': {'id': 280, 'title': 'Kharkiv'}}]
{'id': 111111111, 'first_name': 'name', 'last_name': 'lastname', 'city': {'id': 280, 'title': 'Kharkiv'}}
111111111 name lastname {'id': 280, 'title': 'Kharkiv'}
280 Kharkiv
Process finished with exit code 0
import sys
print(sys.path)
from math import factorial
def multiply(lst):
answer = 1
for i in lst:
answer *= i
return answer
number = 100
print(multiply(range(1, number + 1)) == factorial(number))