This repository has been archived by the owner on Jan 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
preguntas.py
79 lines (68 loc) · 2.6 KB
/
preguntas.py
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
def escape(html):
return html.replace('&', '&').replace('<', '<').replace('>', '>').replace('"', '"').replace("'", ''')
def ciclo(numpregunta):
print("\nPregunta " + str(numpregunta) + ".")
grupo = "g4"
pregunta = "s" + str(numpregunta)
tit = str(numpregunta) + ". " + escape(input("titulo: "))
op1 = "a. " + escape(input("opcion 1: "))
op2 = "b. " + escape(input("opcion 2: "))
op3 = "c. " + escape(input("opcion 3: "))
op4 = escape(input("opcion 4: "))
op5 = escape(input("opcion 5: "))
if op4 == "tc":
op4 = "Todas son correctas"
if op5 == "ti":
op5 = "Todas son incorrectas"
op4 = "d. " + op4
op5 = "e. " + op5
idPregunta = grupo + pregunta
idResp1 = idPregunta + "o1"
idResp2 = idPregunta + "o2"
idResp3 = idPregunta + "o3"
idResp4 = idPregunta + "o4"
idResp5 = idPregunta + "o5"
string = f"""
<div id="{idPregunta}" class="pregunta">
<p>{tit}</p>
<div>
<input type="radio" name="{idPregunta}" id="{idResp1}" value="a">
<label for="{idResp1}">
{op1}
</label>
</div>
<div>
<input type="radio" name="{idPregunta}" id="{idResp2}" value="b">
<label for="{idResp2}">
{op2}
</label>
</div>
<div>
<input type="radio" name="{idPregunta}" id="{idResp3}" value="c">
<label for="{idResp3}">
{op3}
</label>
</div>
<div>
<input type="radio" name="{idPregunta}" id="{idResp4}" value="d">
<label for="{idResp4}">
{op4}
</label>
</div>
<div>
<input type="radio" name="{idPregunta}" id="{idResp5}" value="e">
<label for="{idResp5}">
{op5}
</label>
</div>
</div>
"""
divs.append(string)
print("\n\n\n")
divs = []
numpreg = int(input("Numero de pregunta: "))
while(True):
ciclo(numpreg)
numpreg = numpreg + 1
for string in divs:
print(string)