Spaces:
Runtime error
Runtime error
import streamlit as st | |
st.markdown(f"## System to Check AnimSchool Grades") | |
grade1 = st.number_input("Grade for graded assignment 1 (5%):") | |
grade2 = st.number_input("Grade for graded assignment 2 (5%):") | |
grade3 = st.number_input("Grade for graded assignment 3 (10%):") | |
grade4 = st.number_input("Grade for graded assignment 4 (10%):") | |
grade5 = st.number_input("Grade for graded assignment 5 (70%):") | |
clicked = st.button('Check now!') | |
def get_concept(grade): | |
if grade >= 93: | |
return 'A' | |
if grade >= 90: | |
return 'A-' | |
if grade >= 87: | |
return 'B+' | |
if grade >= 83: | |
return 'B' | |
if grade >= 80: | |
return 'B-' | |
if grade >= 77: | |
return 'C+' | |
if grade >= 73: | |
return 'C' | |
if grade >= 70: | |
return 'C-' | |
if grade >= 67: | |
return 'D+' | |
if grade > 63: | |
return 'D' | |
if grade > 60: | |
return 'D-' | |
return 'F' | |
if clicked: | |
st.markdown(f"###### The grade for the first assignment was {grade1}. It represents a concept of {get_concept(grade1)}.") | |
st.markdown(f"###### The grade for the second assignment was {grade2}. It represents a concept of {get_concept(grade2)}.") | |
st.markdown(f"###### The grade for the third assignment was {grade3}. It represents a concept of {get_concept(grade3)}.") | |
st.markdown(f"###### The grade for the 4º assignment was {grade4}. It represents a concept of {get_concept(grade4)}.") | |
st.markdown(f"###### The grade for the 5º assignment was {grade5}. It represents a concept of {get_concept(grade5)}.") | |
final_grade = (grade1*0.05)+(grade2*0.05)+(grade3*0.1)+(grade4*0.1)+(grade5*0.7) | |
color = 'red' if final_grade < 73 else 'blue' | |
complement = 'REPROVED' if final_grade < 73 else 'APPROVED' | |
st.markdown(f"<h3 style='color: {color};'>{complement}.<br />The final grade of student is {final_grade}. It represents a concept of {get_concept(final_grade)}.</h3>", unsafe_allow_html=True) | |