if text == 'first' or 'second':
text == 'first'
'second'
from datetime import datetime
def foo():
print('ok ')
start = datetime.now()
for i in range(100000000):
delta = datetime.now() - start
if delta.seconds > 0:
foo()
start = datetime.now()
call.data.split('.')[1]
import random as rd
total_attempts = 0
for _ in range(10):
attempts = 0
last_result = None
counter = 0
results = []
while True:
current_result = rd.choice(["О", "P"])
results.append(current_result)
if current_result == last_result:
counter += 1
else:
counter = 1
last_result = current_result
attempts += 1
if counter == 3:
break
print(f"{' '.join(results)} (Попыток: {attempts})")
total_attempts +=attempts
print(f"Среднее количество попыток: {total_attempts / 10:.1f}")
item_db = cur.execute("SELECT * FROM direction_db WHERE id=(%s)" % row).fetchone()
for row in range(2....
but1= types.InlineKeyboardButton('Утром', callback_data='daypart|утро')
but2= types.InlineKeyboardButton('Днём', callback_data= 'daypart|день')
@bot.callback_query_handler(func=lambda call: call.data.split('|')[0]=='daypart')
with open('data.json') as f:
data = json.load(f)
class Author2(BaseModel):
name: str
class Book(BaseModel):
title: str
author2: Author2 | None
books = [Book(**book) for book in data]
markup = types.InlineKeyboardMarkup(row_width=8)
sq_s_g3 = f"SELECT * FROM '{player1}-{player2}'"
cursor.execute(sq_s_g3)
records = cursor.fetchall()
for row in records:
markup.add(types.InlineKeyboardButton(text = row[1], callback_data = row[0]))