Spaces:
Sleeping
Sleeping
File size: 1,372 Bytes
e3d3bfd 8d3a4e7 e3d3bfd |
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 |
import streamlit as st
def calculate_grade(midterm_score, final_score, attendance_score, midterm_weight, final_weight, attendance_weight):
total_score = (midterm_score * midterm_weight/100) + (final_score * final_weight/100) + (attendance_score * attendance_weight/100)
if total_score >= 90:
grade = 'A'
elif total_score >= 80:
grade = 'B'
elif total_score >= 70:
grade = 'C'
elif total_score >= 60:
grade = 'D'
else:
grade = 'F'
return total_score, grade
st.title("Student Grade Calculator Bilge Balga")
midterm_score = st.slider("Midterm Score (0-100)", min_value=0, max_value=100, value=75, step=1)
final_score = st.slider("Final Score (0-100)", min_value=0, max_value=100, value=80, step=1)
attendance_score = st.slider("Attendance Score (0-100)", min_value=0, max_value=100, value=90, step=1)
midterm_weight = st.slider("Midterm Weight (%)", min_value=0, max_value=100, value=30, step=1)
final_weight = st.slider("Final Weight (%)", min_value=0, max_value=100, value=50, step=1)
attendance_weight = st.slider("Attendance Weight (%)", min_value=0, max_value=100, value=20, step=1)
total_score, grade = calculate_grade(midterm_score, final_score, attendance_score, midterm_weight, final_weight, attendance_weight)
st.write(f"Total Score: {total_score:.2f}")
st.write(f"Grade: {grade}") |