MuhammadHananKhan123's picture
Update app.py
7f1a966 verified
raw
history blame contribute delete
732 Bytes
import streamlit as st
def calculate_note_average(notes):
if not notes:
return None
try:
numbers = [float(note.strip()) for note in notes.split(",")]
return sum(numbers) / len(numbers)
except ValueError:
return None
st.title("Note Calculator App")
st.write("This app calculates the average of notes you input.")
notes_input = st.text_input("Enter your notes (comma-separated):", placeholder="e.g., 85, 90, 78")
if st.button("Calculate Average"):
average = calculate_note_average(notes_input)
if average is None:
st.error("Please enter valid numeric values separated by commas.")
else:
st.success(f"The average of your notes is: **{average:.2f}**")