-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfun.py
More file actions
30 lines (21 loc) · 742 Bytes
/
Copy pathfun.py
File metadata and controls
30 lines (21 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import json
from random import randint
def Idgen():
with open("data/qs.json","r",encoding="utf8")as openfile:
qsData =json.load(openfile)
qsDataSize = len(qsData)
qsId =str(randint(0,qsDataSize))
return qsId
def readQs(qsId):
with open("data/qs.json","r",encoding="utf8")as openfile:
qsData =json.load(openfile)
qsDataSize = len(qsData)
return qsData[qsId]
def getans(qsId):
with open("data/ans.json","r",encoding="utf8")as openfile:
ansData =json.load(openfile)
return ansData[qsId]
def getWrongAns(qsId):
with open("data/wrongAns.json","r",encoding="utf8")as openfile:
wrongAns =json.load(openfile)
return wrongAns[qsId]