Spaces:
Sleeping
Sleeping
drmurataltun
commited on
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
def calculate_grade(midterm_score, final_score, attendance_score, midterm_weight, final_weight, attendance_weight):
|
4 |
+
total_score = (midterm_score * midterm_weight/100) + (final_score * final_weight/100) + (attendance_score * attendance_weight/100)
|
5 |
+
|
6 |
+
if total_score >= 90:
|
7 |
+
grade = 'A'
|
8 |
+
elif total_score >= 80:
|
9 |
+
grade = 'B'
|
10 |
+
elif total_score >= 70:
|
11 |
+
grade = 'C'
|
12 |
+
elif total_score >= 60:
|
13 |
+
grade = 'D'
|
14 |
+
else:
|
15 |
+
grade = 'F'
|
16 |
+
|
17 |
+
return total_score, grade
|
18 |
+
|
19 |
+
st.title("Student Grade Calculator")
|
20 |
+
|
21 |
+
midterm_score = st.slider("Midterm Score (0-100)", min_value=0, max_value=100, value=75, step=1)
|
22 |
+
final_score = st.slider("Final Score (0-100)", min_value=0, max_value=100, value=80, step=1)
|
23 |
+
attendance_score = st.slider("Attendance Score (0-100)", min_value=0, max_value=100, value=90, step=1)
|
24 |
+
|
25 |
+
midterm_weight = st.slider("Midterm Weight (%)", min_value=0, max_value=100, value=30, step=1)
|
26 |
+
final_weight = st.slider("Final Weight (%)", min_value=0, max_value=100, value=50, step=1)
|
27 |
+
attendance_weight = st.slider("Attendance Weight (%)", min_value=0, max_value=100, value=20, step=1)
|
28 |
+
|
29 |
+
total_score, grade = calculate_grade(midterm_score, final_score, attendance_score, midterm_weight, final_weight, attendance_weight)
|
30 |
+
|
31 |
+
st.write(f"Total Score: {total_score:.2f}")
|
32 |
+
st.write(f"Grade: {grade}")
|