Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Dec 22, 2023. It is now read-only.

Commit 7f2b165

Browse files
Add files via upload
1 parent 3f44b9e commit 7f2b165

File tree

10 files changed

+552
-0
lines changed

10 files changed

+552
-0
lines changed
29.6 KB
Loading[フレーム]
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
from tkinter import *
2+
from tkinter import messagebox
3+
from questions import *
4+
5+
class Project:
6+
def __init__(self):
7+
self.que=None
8+
self.ans=None
9+
self.correct=0
10+
self.count=-1
11+
self.__correct_answer=None
12+
self.__answer=None
13+
self.__question=None
14+
15+
def course(self):
16+
self.correct=0
17+
self.count=-1
18+
B.config(text="Start")
19+
if s.get()=="Python":
20+
self.que=python_que
21+
self.ans=python_ans
22+
elif s.get()=="C":
23+
self.que=c_que
24+
self.ans=c_ans
25+
26+
27+
def set_(self):
28+
if self.que==None:
29+
messagebox.showinfo("Error","Please select course first...")
30+
return
31+
self.count+=1
32+
33+
if self.count==len(self.que):
34+
messagebox.showinfo("Result","You have answered {0} out of {1} questions correctly".format(self.correct,self.count))
35+
exit()
36+
37+
if(self.count==len(self.que)-1):
38+
B.config(text="Finish")
39+
else:
40+
B.config(text="Next")
41+
42+
self.__question=self.que[self.count]
43+
self.__answer=self.ans[self.__question]
44+
l.config(text=self.__question)
45+
for i in range(0,4):
46+
v[i].set(self.__answer[i])
47+
self.__correct_answer=self.__answer[4]
48+
49+
def fun(self,y,n):
50+
if y==self.__correct_answer:
51+
self.correct+=1
52+
n.config(activebackground="green")
53+
else:
54+
n.config(activebackground="red")
55+
self.set_()
56+
57+
58+
59+
obj=Project()
60+
scr=Tk(className="quiz")
61+
s=StringVar()
62+
main_menu=Menu(scr)
63+
file_menu=Menu(main_menu,tearoff=0)
64+
65+
course_menu=Menu(file_menu,tearoff=0)
66+
course_menu.add_radiobutton(label="Python",value="Python",variable=s,command=obj.course)
67+
course_menu.add_radiobutton(label="C",value="C",variable=s,command=obj.course)
68+
69+
file_menu.add_cascade(label="Course",menu=course_menu)
70+
file_menu.add_command(label="Exit",command=exit)
71+
main_menu.add_cascade(label="file",menu=file_menu)
72+
scr.config(menu=main_menu)
73+
74+
l=Label(scr,font=("consolas",20),relief="groove",width=40,height=2,wraplength=600,bg="steel blue")
75+
l.grid(row=0,column=0,columnspan=20,sticky="news")
76+
77+
b=[]
78+
for i in range(0,4):
79+
b.append(Button())
80+
v=[]
81+
for i in range(0,4):
82+
v.append(StringVar())
83+
84+
85+
b[0]=Button(scr,textvariable=v[0],font=("consolas",20),anchor="w",width=20,activebackground="light blue",command=lambda :obj.fun(v[0].get(),b[0]))
86+
b[0].grid(row=2,column=0,sticky=W)
87+
88+
b[1]=Button(scr,textvariable=v[1],font=("consolas",20),anchor="w",width=20,command=lambda :obj.fun(v[1].get(),b[1]))
89+
b[1].grid(row=2,column=1,sticky=S)
90+
91+
b[2]=Button(scr,textvariable=v[2],font=("consolas",20),anchor="w",width=20,command=lambda :obj.fun(v[2].get(),b[2]))
92+
b[2].grid(row=3,column=0,sticky=W)
93+
94+
b[3]=Button(scr,textvariable=v[3],font=("consolas",20),anchor="w",width=20,command=lambda :obj.fun(v[3].get(),b[3]))
95+
b[3].grid(row=3,column=1,sticky=S)
96+
97+
B=Button(scr,text="Start",font=("consolas",20),width=40,height=1,bg="black",fg="white",command=obj.set_)
98+
B.grid(row=10,column=0,columnspan=2,sticky="news")
99+
#B.geometry('{0}x{1}+0+0'.format(scr.winfo_screenwidth(),200))
100+
101+
scr.mainloop()
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Programming Quiz Project
2+
The project is about developing a quiz of 10 questions using python programming language on graphical user interphase.
3+
4+
### Prerequisites
5+
1. Tkinter
6+
7+
8+
### How to run the script
9+
<li> Download the prerequisited library using `pip install tkinter` command on the terminal/command prompt
10+
<li> Run the Graphical user Interphase using `python Quiz.py`
11+
<li> Go to <strong>file</strong> menu to select the programming language for the quiz.
12+
<li> Click on start button to proceed with the quiz
13+
14+
![script execution](Dashboard.jpg)
15+
16+
<li> After successful submission, a popup will display the result
17+
18+
![script execution](popup.jpg)
19+
20+
### Quiz Enhancement
21+
22+
<li> Changes in questions.py-: <br>
23+
1. Add questions que dictonary (eg java_que={0 : ...,1 : ...})
24+
<br>
25+
2. Add option and answer to the answer dictonary ( eg java_ans={question : [options , correct answer]})
26+
<br>
27+
<li> Changes in Quiz.py <br>
28+
1. Add th course to the course() function (Line 15)
29+
<br>
30+
elif s.get()=="Java":
31+
<br>
32+
<lr> self.que=java_que
33+
<lr> self.ans=java_ans
34+
<br>
35+
2. Add course to the file menu (Line 65)
36+
<br>
37+
course_menu.add_radiobutton(label="Java",value="Java",variable=s,command=obj.course)
38+
<br>
39+
<li> Save and run the script using the instructions given above
40+
41+
42+
## *Author Name*
43+
[Pulkit Dhingra](https://github.com/Pulkit12dhingra)
Binary file not shown.
Binary file not shown.
34.8 KB
Loading[フレーム]
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
python_que={
2+
0:"What is python",
3+
1:"Who is founder of Python",
4+
2:"What is variable",
5+
3:"What is symbol of List",
6+
4:"What is symbol of tuple",
7+
5:"What is symbol of Set",
8+
6:"What is symbol of dictionary",
9+
7:"Python was launched in..",
10+
8:"Latest Version of python is..",
11+
9:"Python is suitable for.."
12+
}
13+
python_ans={
14+
"What is variable":["Container","Object","Class","Structure","Object"],
15+
"What is symbol of List":["( )","{ }","[ ]","None of the above","[ ]"],
16+
"What is symbol of tuple":["( )","{ }","[ ]","None of the above","( )"],
17+
"What is symbol of Set":["( )","{ }","[ ]","None of the above","{ }"],
18+
"What is symbol of dictionary":["( )","{ }","[ ]","None of the above","{ }"],
19+
"Who is founder of Python":["Steve Jobs","James Gosling","Guido von Rossum","Dennis Richie","Guido von Rossum"],
20+
"Python was launched in..":["1990","2003","1980","1996","1990"],
21+
"What is python":["Scripting language","Programming language","Markup Language","Snake","Programming language"],
22+
"Latest Version of python is..":["3.8.4","3.9.5","3.8.9","3.9.0","3.9.0"],
23+
"Python is suitable for..":["GUI Application","Web application","Android","All of these","All of these"]}
24+
25+
c_que={
26+
0:"What is c",
27+
1:"Who is father of c",
28+
2:"What is strength of C language",
29+
3:"C was launched in",
30+
4:"What is format specifier of char",
31+
5:"what is size of int in 64 bit os",
32+
6:"what is format specifier of double",
33+
7:"what is size of double",
34+
8:"output of for(;;)",
35+
9:"what is symbol of function"
36+
}
37+
c_ans={
38+
"What is c":["Scripting language","Programming language","Markup Language","Snake","Programming language"],
39+
"Who is father of c":["Steve Jobs","James Gosling","Guido von Rossum","Dennis Richie","Dennis Richie"],
40+
"What is strength of C language":["data structure","Pointer","Speed","B and C both","B and C both"],
41+
"C was launched in":["1970","1972","1980","1982","1972"],
42+
"What is format specifier of char":["%ch","%c","%char","%chr","%c"],
43+
"what is size of int in 64 bit os":["1 byte","8 bit","4 bit","32 bit","4 bit"],
44+
"what is format specifier of double":["%d","%l","%lf","%Lf","%d"],
45+
"what is size of double":["1 byte","8 bit","8 byte","32 bit","8 byte"],
46+
"output of for(;;)":["syntax error","0 iteration","infinite iteration","runtime error","infinite iteration"],
47+
"what is symbol of function":["( )","{ }","[ ]","< >","( )"]
48+
}
49+
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Heart Attack Analysis & Prediction
2+
3+
# Dataset Information
4+
5+
Heart attacks result in severe medical conditions that may be fatal if not handled correctly. Due to the current lifestyle, heart attacks are much more often than in the past. With the help of modern-day technologies and the capacity of storing the data, we can create a heart attack prediction mechanism that would allow us to measure the chances of having a heart attack on a person.
6+
7+
### Attribute Information:
8+
9+
Input variables: \
10+
1 - Age : Age of the patient \
11+
2 - Sex : Sex of the patient \
12+
3 - exang: exercise induced angina (1 = yes; 0 = no) \
13+
4 - ca: number of major vessels (0-3) \
14+
5 - cp : Chest Pain type chest pain type \
15+
<ul>
16+
<li> Value 1: typical angina </li>
17+
<li> Value 2: atypical angina </li>
18+
<li> Value 3: non-anginal pain </li>
19+
<li> Value 4: asymptomatic </li>
20+
</ul>
21+
22+
6 - trtbps : resting blood pressure (in mm Hg) \
23+
7 - chol : cholestoral in mg/dl fetched via BMI sensor \
24+
8 - Trihalomethanes-> Amount of Trihalomethanes in μg/L \
25+
9 - fbs : (fasting blood sugar > 120 mg/dl) (1 = true; 0 = false) \
26+
10 - est_ecg : resting electrocardiographic results
27+
<ul>
28+
<li> Value 0: normal </li>
29+
<li> Value 1: having ST-T wave abnormality (T wave inversions and/or ST elevation or depression of > 0.05 mV) </li>
30+
<li> Value 2: showing probable or definite left ventricular hypertrophy by Estes' criteria </li>
31+
</ul>
32+
11 - thalach : maximum heart rate achieved
33+
34+
Output variable (based on sensory data): \
35+
10 - target : 0= less chance of heart attack 1= more chance of heart attack
36+
37+
38+
# Libraries
39+
40+
41+
<li>pandas
42+
<li>matplotlib
43+
<li>seaborn
44+
<li>plotly
45+
<li>scikit-learn
46+
<li>xgboost
47+
48+
# Algorithm
49+
<li>XGBoost</li>
50+
51+
<br>
52+
53+
**Model Accuracy:** 80.00
54+

‎Scripts/Miscellaneous/heart attack analysis/heart-attack-analysis-xg-boost.ipynb

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /