MuhammadHananKhan123 commited on
Commit
7f1a966
·
verified ·
1 Parent(s): 697a155

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py CHANGED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ def calculate_note_average(notes):
4
+ if not notes:
5
+ return None
6
+ try:
7
+ numbers = [float(note.strip()) for note in notes.split(",")]
8
+ return sum(numbers) / len(numbers)
9
+ except ValueError:
10
+ return None
11
+
12
+ st.title("Note Calculator App")
13
+ st.write("This app calculates the average of notes you input.")
14
+
15
+ notes_input = st.text_input("Enter your notes (comma-separated):", placeholder="e.g., 85, 90, 78")
16
+
17
+ if st.button("Calculate Average"):
18
+ average = calculate_note_average(notes_input)
19
+ if average is None:
20
+ st.error("Please enter valid numeric values separated by commas.")
21
+ else:
22
+ st.success(f"The average of your notes is: **{average:.2f}**")
23
+