numberadder / app.py
eaglelandsonce's picture
Create app.py
9b96db1 verified
raw
history blame
645 Bytes
import streamlit as st
# Streamlit application
st.title("Sum Calculator")
# Input for user to enter numbers in the specified format
user_input = st.text_input("Enter numbers to add (e.g., 3+9+12+...):")
# Check if input is provided
if user_input:
try:
# Parse the input and calculate the sum
numbers = [int(num.strip()) for num in user_input.split("+")]
total_sum = sum(numbers)
st.write(f"The sum of the numbers is: {total_sum}")
except ValueError:
st.write("Please enter a valid sequence of numbers separated by '+' signs.")
else:
st.write("Please enter numbers in the format 3+9+12+...")