Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Feedback #1

Open
wants to merge 4 commits into
base: feedback
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: python
python:
- "3.9"
- "3.5"
- "3.10"
# command to run tests
script:
- python TestModule1.py
60 changes: 60 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Function details and how they work

## Motivation
We want to create a quiz apps for the authoized student to test their understanding on the material before taking the actual exam. This application will ask user for the subject(Data533, Data541, Data530) and difficulty (easy, normal, hard, all(default)) that they want to be quized on. And validated their answer by giving feedback to them after every question. Finally the quiz apps will calculate a total marks after finishing all the question in order for them to keep track on their understanding on a specific topic. The application also allows teacher to access the quiz to see what question is the student being ask and for error checking purpose.
## Package1
This package will include the personal information input,output and checking. Also, we will divide it into two categories, student and teacher.
### Module 1
In Module 1, we will set functions about **information-input**, such as name, ID. If a student, users need to input their major and degree; if a teacher, users need to input their research direction and teaching length.
- def group():
- def name():
- def ID():
- def major():
- def research():
### Module 2
In Module 2, we will set functions about **information-output**, we use the **inheritance** in this module. The Group will show the common information: name and ID. Inside the Group, there are Student (show additional information about major and degree) and Teacher (show additional information about research and length)
- class Group:
- class Student(Group):
- class Teacher(Group):
### Module 3
Checking whether student or teacher is in the list, according to their ID, and checking whether the input of name is empty.
**Tips:As a testing example, now we only include two ID in the list,"12345" and "54321"**
- def __init__(self):
- def check_inlist(self, input):
- def check_IsNull(self):


## Package2
This sub-package is all about processing question database and contain all the necessary checking function for the question and answer when user input in the quiz apps. This Sub-Package include 3 Module, **Checking**(the brain of the quiz apps), **Question**(for processing database question) and **Course**(appending defaulty to the database question)
### Module 1
This Module contain ```class Checking: ```, which is the brain of the quizzing apps, it contain all the necessary checking function such as:
- isEmpty(self) - checking if there is more question to the question set. If there is, run function next_question() to prompt the user with new question and ask for their input.
- next_question(self) - prompt the user with new question and ask for their input and validate user answer using check_answer().
- check_answer(self, user_answer, correct_answer) - checking if the user input matched the database answer and if not prompt the user with the correct anser.
- check_score(self) - checking user score.

### Module 2
This Module contain ```class Question(Checking):```,which is inherited from Checking class, this class only have one function:
- __init__ (self, q_text, q_answer, q_diff) - process database’s question and allocate them into question, anser and difficulty.


### Module 3
This Module contain ```Course(Question,Checking):``` which is inherited from Checking class and Question class, this module are for appending database’s questions, answer into separate array with different difficulty for the other class to access based on user inputs in the future. this class only have 4 function:
- append_text(self,question) - for appending database’s question in to its own question array
- append_answer(self,question) - for appending database’s answer in to its own answer array
- append_difficulty(self,question) - for appending database’s difficultyin to its own difficulty array
- append_courseq(self) - for appending database’s question, answer according to the difficulty into 4 different question set array for user to access it after knowing the user difficulty that he/she want to be quiz on.














276 changes: 276 additions & 0 deletions main.ipynb

Large diffs are not rendered by default.

Binary file added pkg/.DS_Store
Binary file not shown.
Binary file added pkg/pkg1/.DS_Store
Binary file not shown.
21 changes: 21 additions & 0 deletions pkg/pkg1/.ipynb_checkpoints/information_check-checkpoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
class Info_Check():

def __init__(self,name,iid):
self.list = ["12345","54321"]
self.name = name
self.iid = iid

def check_inlist(self):
if self.iid.lower() in self.list:
return True
else:
return False

def check_IsNull(self):
if self.name=="":
return True
else:
return False



27 changes: 27 additions & 0 deletions pkg/pkg1/.ipynb_checkpoints/information_input-checkpoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
def group():
g=input("Are you a student or a teacher?")
return g

def name():
n=input("What's your name?")
return n

def ID():
I=input("What's your ID? ")
return I

# a student
def major():
n=input("What's your major?(optional)")
return n
def degree():
n=input("Are you an undergraduate or postgraduate?(optional)")
return n
# a teacher
def research():
n=input("what is your research direction?(optional)")
return n

def length():
n=input("How many years since be a tearcher?(optional)")
return n
28 changes: 28 additions & 0 deletions pkg/pkg1/.ipynb_checkpoints/information_output-checkpoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
class Group:
def __init__(self, name, ID):
self.name = name
self.ID = ID

def display(self):
print('Name:{} ID:{} '.format(self.name, self.ID))


class Student(Group):
def __init__(self, name, ID, major, degree):
Group.__init__(self, name, ID)
self.major=major
self.degree=degree

def display(self):
Group.display(self)
print('Major: {} Degree: {}'.format(self.major, self.degree))

class Teacher(Group):
def __init__(self, name, ID, research, length):
Group.__init__(self, name, ID)
self.research=research
self.length=length

def display(self):
Group.display(self)
print('Research: {} Length: {}'.format(self.research, self.length))
Binary file not shown.
Binary file not shown.
Binary file not shown.
21 changes: 21 additions & 0 deletions pkg/pkg1/information_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
class Info_Check():

def __init__(self,name,iid):
self.list = ["12345","54321"]
self.name = name
self.iid = iid

def check_inlist(self):
if self.iid.lower() in self.list:
return True
else:
return False

def check_IsNull(self):
if self.name=="":
return True
else:
return False



29 changes: 29 additions & 0 deletions pkg/pkg1/information_input.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
def group():
g=input("Are you a student or a teacher?")
return g

def name():
n=input("What's your name?")
return n

def ID():
I=input("What's your ID? ")
return I

# a student
def major():
n=input("What's your major?(optional)")
return n
def degree():
n=input("Are you an undergraduate or postgraduate?(optional)")
return n
# a teacher
def research():
n=input("what is your research direction?(optional)")
return n

def length():
n=input("How many years since be a tearcher?(optional)")
return n

try
28 changes: 28 additions & 0 deletions pkg/pkg1/information_output.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
class Group:
def __init__(self, name, ID):
self.name = name
self.ID = ID

def display(self):
print('Name:{} ID:{} '.format(self.name, self.ID))


class Student(Group):
def __init__(self, name, ID, major, degree):
Group.__init__(self, name, ID)
self.major=major
self.degree=degree

def display(self):
Group.display(self)
print('Major: {} Degree: {}'.format(self.major, self.degree))

class Teacher(Group):
def __init__(self, name, ID, research, length):
Group.__init__(self, name, ID)
self.research=research
self.length=length

def display(self):
Group.display(self)
print('Research: {} Length: {}'.format(self.research, self.length))
56 changes: 56 additions & 0 deletions pkg/pkg2/.ipynb_checkpoints/Course-checkpoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
from pkg.pkg2 import Question as Q
from pkg.pkg2 import Checking as C

class Course(Q.Question,C.Checking):
def __init__(self,question_data,input_diff,usr):
self.course_q = []
self.ez_course_q = []
self.hard_course_q = []
self.normal_course_q = []
self.question_data = question_data
self.inputdiff = input_diff
self.usr = usr
self.append_courseq()

if self.inputdiff == "easy":
C.Checking.__init__(self,self.ez_course_q,self.usr)
elif self.inputdiff == "normal":
C.Checking.__init__(self,self.normal_course_q,self.usr)
elif self.inputdiff == "hard":
C.Checking.__init__(self,self.hard_course_q,self.usr)
else:
C.Checking.__init__(self,self.course_q,self.usr)


def append_text(self,question):
self.question_text = question["question"]
return question["question"]

def append_answer(self,question):
self.question_answer = question["correct_answer"]
return question["correct_answer"]

def append_difficulty(self,question):
self.question_difficulty = question["difficulty"]
return question["difficulty"]


def append_courseq(self):
for question in self.question_data:
self.append_text(question)
self.append_answer(question)
self.append_difficulty(question)
new_question = Q.Question(self.question_text, self.question_answer,self.question_difficulty)

self.course_q.append(new_question)

if self.question_difficulty == "easy":
new_question = Q.Question(self.question_text, self.question_answer,self.question_difficulty)
self.ez_course_q.append(new_question)
elif self.question_difficulty == "normal":
new_question = Q.Question(self.question_text, self.question_answer,self.question_difficulty)
self.normal_course_q.append(new_question)
elif self.question_difficulty == "hard":
new_question = Q.Question(self.question_text, self.question_answer,self.question_difficulty)
self.hard_course_q.append(new_question)

8 changes: 8 additions & 0 deletions pkg/pkg2/.ipynb_checkpoints/Question-checkpoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from pkg.pkg2 import Checking as C

class Question(C.Checking):
def __init__(self, q_text, q_answer, q_diff):
self.text = q_text
self.answer = q_answer
self.diff = q_diff

52 changes: 52 additions & 0 deletions pkg/pkg2/Checking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
class Checking:

def __init__(self, questions, usr):
self.quesBank = questions
self.usr = usr
# self.usr_input = usr_input
self.NumInQSet = len(questions)
self.quesNum = 0
self.score = 0
self.ez_course_q = []
self.hard_course_q = []
self.normal_course_q = []

def next_question(self):
current_question = self.quesBank[self.quesNum]

self.quesNum += 1
if self.usr == 'teacher':
print("Question " + str(self.quesNum)+ ". " + str(current_question.text))
self.check_answer(current_question.answer, current_question.answer)
else:
usr_input = input("Question " + str(self.quesNum)+ ". " + str(current_question.text))
self.check_answer(usr_input.lower(), current_question.answer)

def isEmpty(self):
return self.quesNum < len(self.quesBank)

def check_answer(self, user_answer, correct_answer):

if user_answer.lower() == correct_answer:
if self.usr == 'teacher':
self.score += 1
print("Correct answer is: " + str(correct_answer)+ "\n")
return(True)

else:
self.score += 1
print("Correct!!! \n \n \n")
return(True)

else:
print("Wrong :( \n \n \n")
print("The correct answer is: " + str(correct_answer)+ "\n")
return(False)

def check_score(self):
print("**************************************** ")
print("**************************************** \n")
print("Final score: " + str(self.score) + " out of " + str(self.quesNum) + ". \n")
print("**************************************** ")
print("**************************************** \n")

Loading