#🔒 Choosing the Right Answer
5 messages · Page 1 of 1 (latest)
@solar plank
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Hey, guys. Need help with python.
I need to make the program accept the user's answers in any order[i.e. I have an answer in the list right now. And most likely for this reason the program accepts answers only in the order in which the answers are located in the list]. I'll send you the code in a moment
The "problem" is in the "proekt" file.
from random import choice
import json
from shifr import encrypt, decrypt
from openpyxl import load_workbook
from cryptography.fernet import Fernet
from parse_excel import file_doc
doc="questions_from_excel.json"
with open('key.key', 'rb') as f:
key= f.read()
data=decrypt(doc, key).decode('UTF-8')
data=json.loads(data)
def menu():
print('1. Открыть файл')
while True:
menu()
vvod = int(input('Введите цифру: '))
if vvod == 1:
rand = choice(data)
print(rand["Текст вопроса"])
for i in rand['Варианты ответа']:
print(i)
# otvet=input('Введите правильный ответ: ')
elif vvod == 2:
pass
# data=decrypt(doc, key).decode('UTF-8')
# data=json.loads(data)
# print(data[0]["Текст вопроса"])
@solar plank
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.