import streamlit as st def main(): st.title("Enhanced Calculator") num1 = st.number_input("Enter the first number:", format="%f") num2 = st.number_input("Enter the second number:", format="%f") operation = st.radio("Select an operation:", ( "Addition (+)", "Subtraction (-)", "Multiplication (*)", "Division (/)", "Exponentiation (^)", "Modulus (%)", "Floor Division (//)" )) if st.button("Calculate"): try: if operation == "Addition (+)": result = num1 + num2 elif operation == "Subtraction (-)": result = num1 - num2 elif operation == "Multiplication (*)": result = num1 * num2 elif operation == "Division (/)": result = num1 / num2 elif operation == "Exponentiation (^)": result = num1 ** num2 elif operation == "Modulus (%)": result = num1 % num2 elif operation == "Floor Division (//)": result = num1 // num2 st.success(f"Result: {result}") except ZeroDivisionError: st.error("Error: Division by zero is not allowed.") if __name__ == "__main__": main()