„question_answer_output.py“ löschen

This commit is contained in:
Marcus Ferl 2022-03-22 23:11:36 +01:00
parent 602d0a1ab4
commit cd58a96b41

View File

@ -1,24 +0,0 @@
import json
from random import randrange
# Einlesen vom Json File
def read_json(filename):
with open(filename,encoding='utf-8') as filename:
data = json.load(filename)
return data
# Zufällige Frage erstellen
def random_question(filename):
min_ = 0
max_ = len(read_json(filename))
random_number = randrange(min_,max_)
questions = read_json(filename)
question = f'Frage #{random_number}: ' + questions[random_number][str(random_number)]['question']
answer = questions[random_number][str(random_number)]['answer']
return question, answer
#print(random_question(config.json_file)[0])