File size: 732 Bytes
7f1a966 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 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}**")
|