class quest_1:
@dp.message_handler(Text(equals="Начать тест 1"))
async def quiz_1(message: types.Message):
module_one = xlrd.open_workbook('biochemistry_1.xls')
sheet = module_one.sheet_by_index(0)
global vals
vals = random.randint(1, 972)
question = sheet.row_values(vals)[0]
true_answer = sheet.row_values(vals)[5]
a = sheet.row_values(vals)[1]
b = sheet.row_values(vals)[2]
c = sheet.row_values(vals)[3]
d = sheet.row_values(vals)[4]
keyboard = types.ReplyKeyboardMarkup(resize_keyboard=True)
button1 = keyboard.add(types.KeyboardButton(text=a))
button2 = keyboard.add(types.KeyboardButton(text=b))
button3 = keyboard.add(types.KeyboardButton(text=c))
button4 = keyboard.add(types.KeyboardButton(text=d))
buttonexit = keyboard.add(types.KeyboardButton(text="Закончить"))
await message.answer(question, reply_markup=keyboard)
@dp.message_handler(Text(equals="Закончить"))
async def return_back(message: types.Message):
await message.answer("Вы закончили тест!")
await cmd_start(message)
@dp.message_handler()
async def quiz_1_check(message: types.Message, vals):
module_one = xlrd.open_workbook('biochemistry_1.xls')
sheet = module_one.sheet_by_index(0)
true_answer = sheet.row_values(vals)[5]
if message.text == true_answer:
await message.reply("верно!")
await quest_1.quiz_1(message)
elif message.text != true_answer:
await message.answer("Неверно! Правильный ответ:")
await message.reply(true_answer)
await quest_1.quiz_1(message)
@dp.callback_query_handler(lambda call: call.data.startswith("answer")