Answer the question
In order to leave comments, you need to log in
How to write a simple Python test for Telegramm?
I'm trying to write a bot in telegram. I want to write a regular test. What would be 20 questions. The bot took 10 or 15 randomly. But it turns out only to write questions sequentially. Tell me the literature for writing.
Answer the question
In order to leave comments, you need to log in
So choose a random question. And better in the oop style (this is an example and only):
import random as rand
class qustion:
def __init__(self, text):
self.asked = False
telegramAPI.sendmessage(text)
answer = telegramAPI.user.message()
def start_quiz():
asked_q = 0
while asked_q < 2:
numb = rand.randint(1, 2)
if numb == 1 and not q1.asked:
q1 = qustion("Text 1")\
q1.asked()
if numb == 2 and not q2.asked:
q2 = qustion("Text 2")\
q2.asked()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question