Spaces:
Running
Running
File size: 645 Bytes
9b96db1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
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+...") |