Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,32 +1,22 @@
|
|
1 |
import streamlit as st
|
2 |
-
import numpy as np
|
3 |
-
import pandas as pd
|
4 |
-
import altair as alt
|
5 |
|
6 |
-
st.
|
7 |
-
|
8 |
-
st.
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
st.
|
17 |
-
|
18 |
-
st.write(
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
columns=['a', 'b', 'c'])
|
27 |
-
st.write(df2.head(5))
|
28 |
-
c = alt.Chart(df2).mark_circle().encode(
|
29 |
-
x='a', y='b', size='c', color='c', tooltip=['a', 'b', 'c'])
|
30 |
-
st.write(c)
|
31 |
-
|
32 |
-
st.latex(r'N_t = \frac{1}{10}')
|
|
|
1 |
import streamlit as st
|
|
|
|
|
|
|
2 |
|
3 |
+
st.title("Calculator")
|
4 |
+
|
5 |
+
col1, col2, col3 = st.columns(3)
|
6 |
+
with col1:
|
7 |
+
a = st.number_input("First number", value=1.0)
|
8 |
+
with col2:
|
9 |
+
b = st.number_input("Second number", value=2.0)
|
10 |
+
with col3:
|
11 |
+
operation = st.selectbox("Choose the operation", ["+", "-", "*", "/"])
|
12 |
+
if operation == "+":
|
13 |
+
st.write(a, "+", b, "=", a + b)
|
14 |
+
elif operation == "-":
|
15 |
+
st.write(a, "-", b, "=", a - b)
|
16 |
+
elif operation == "*":
|
17 |
+
st.write(a, "*", b, "=", a * b)
|
18 |
+
elif operation == "/":
|
19 |
+
if b == 0:
|
20 |
+
st.warning("Divided by zero")
|
21 |
+
else:
|
22 |
+
st.write(a, "/", b, "=", a / b)
|
|
|
|
|
|
|
|
|
|
|
|
|
|