Hi Siddhant, follows my code⌠after the code there is a sample of the questions structure, in the last column I have the right answer.
import pandas as pd
import streamlit as st
import csv
from random import shuffle
#Global initializations
rights = 0
questions_list =
list_responses =
wrong_questions =
right_questions =
if âresponsesâ not in st.session_state:
st.session_state.responses = {}
if âform_submittedâ not in st.session_state:
st.session_state.form_submitted = False
st.title(âArchimate Mock Test!â)
with st.form(key=âmy_formâ, clear_on_submit=True, enter_to_submit=False):
#st.write("Entrando no form= " + str(st.session_state.form_submitted))
if st.session_state.form_submitted == False:
questions_nums = 1
f = open (âArchimate_Data_Bank.csvâ,ârâ, encoding=âUTF8â)
csv_reader = csv.reader(f)
for line in csv_reader:
questions_list.append(line[0])
f.close()
shuffle(questions_list)
newlist = questions_list[:4]
for qt in newlist:
f = open (âArchimate_Data_Bank.csvâ,ârâ, encoding=âUTF8â)
csv_reader = csv.reader(f)
for line in csv_reader:
if line[0]== qt :
st.write(str(questions_nums) + "-- " + line[1])
st.write(line[2])
st.write(line[3])
st.write(line[4])
st.write(line[5])
right_questions.append(line[6])
st.selectbox("Enter response: â,(âAâ, âBâ, âCâ, âDâ), key=f"question_{questions_nums}â, index=None)
questions_nums = questions_nums+1
f.close()
submit_button = st.form_submit_button(label=âSubmitâ)
st.write(right_questions)
if submit_button:
st.write(st.session_state.form_submitted)
st.session_state.form_submitted = True
for i in range(questions_nums-1):
st.write(i)
st.session_state.responses[f"question_{i+1}"] = st.session_state[f"question_{i+1}"]
if st.session_state.responses[f"question_{i+1}"] == right_questions[i]:
st.warning("Correct!",icon="â ď¸")
rights = rights+1
list_responses.append(st.session_state.responses[f"question_{i+1}"])
else:
st.warning("Incorrect",icon="â ď¸")
wrong_questions.append(i+1)
list_responses.append(st.session_state.responses[f"question_{i+1}"])
st.write("Responses:", st.session_state)
st.write(list_responses)
for j in range(len(list_responses)):
st.write ("Question "+ str(j+1) +") " + list_responses[j])
if wrong_questions == []:
st.write("No wrong answers! Congrats!")
else:
st.write ("Wrong Questions:")
for w in wrong_questions:
st.write ("Question: "+str(w))
st.write("Rights: ", rights)
st.write("len List resp: ", len(list_responses))
final_score = rights/len(list_responses)*100
st.write("Your final score is: "+str(final_score)+"%")
st.stop()
1,âISO/IEC/IEEE defines architecture as the fundamental concepts or properties of a system in its environment embodied in its elements, relationships, and in the principles of its design and evolution.â,A) ISO/IEC/IEEE 42010,B) ISO/IEC/IEEE 15289,C) ISO/IEC/IEEE 12207,D) ISO/IEC/IEEE 29148,A
2,The ArchiMate modeling language was created in the period ______ by the Telematica Instituut.,A) 2000-2002,B) 2002-2004,C) 2004-2006,D) 2006-2008,B
3,Which of the following statement is correct regarding the Architecture Viewpoint?,A) A representation of a system from the perspective of a related set of concerns,B) A specification of the conventions for a particular kind of architecture view,C) A collection of concepts in the context of the ArchiMate language structure,âD) A connection between a source and target concept. Classified as structural, dependency, dynamic, or otherâ,B
4,Which of the following statement best describes the Stakeholder?,A) Executives of the company,B) All members of the organisation,âC) People who have key roles in, or concerns about the systemâ,D) A stockholder who owns shares in the organisation,C
5,How many layers of the ArchiMate core language?,A) Two,B) Three,C) Four,D) Five,B