From 0cab0b0d4cfcf473c5795ef484d83bf46e10ff87 Mon Sep 17 00:00:00 2001 From: lilimaoo Date: Fri, 4 Oct 2024 06:09:47 +0000 Subject: [PATCH 1/2] add basic python code --- hello.py | 1 + list.py | 4 ++++ students.json | 23 +++++++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 hello.py create mode 100644 list.py create mode 100644 students.json diff --git a/hello.py b/hello.py new file mode 100644 index 0000000..e75154b --- /dev/null +++ b/hello.py @@ -0,0 +1 @@ +print("hello world") \ No newline at end of file diff --git a/list.py b/list.py new file mode 100644 index 0000000..3bee904 --- /dev/null +++ b/list.py @@ -0,0 +1,4 @@ +#create a list of fruits +fruits = ['apple', 'banana', 'cherry'] + +print(fruits) diff --git a/students.json b/students.json new file mode 100644 index 0000000..1df5f90 --- /dev/null +++ b/students.json @@ -0,0 +1,23 @@ +{ + "students": [ + { + "id": 1, + "name": "Alice", + "age": 20, + "grades": { + "math": 90, + "science": 85 + } + }, + { + "id": 2, + "name": "Bob", + "age": 22, + "grades": { + "math": 75, + "science": 80 + } + } + ] + } + \ No newline at end of file From f09e404113f0ebdc57e4511a9a7dde6ff9ec0926 Mon Sep 17 00:00:00 2001 From: lilimaoo Date: Fri, 4 Oct 2024 07:37:38 +0000 Subject: [PATCH 2/2] basic-python --- hello.py | 1 - streamlit_test1.py | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) delete mode 100644 hello.py create mode 100644 streamlit_test1.py diff --git a/hello.py b/hello.py deleted file mode 100644 index e75154b..0000000 --- a/hello.py +++ /dev/null @@ -1 +0,0 @@ -print("hello world") \ No newline at end of file diff --git a/streamlit_test1.py b/streamlit_test1.py new file mode 100644 index 0000000..0cd7732 --- /dev/null +++ b/streamlit_test1.py @@ -0,0 +1,22 @@ +import streamlit as st + +if 'test_history' not in st.session_state: + st.session_state.test_history = [] + + +text_input = st.text_input('Enter some text') + +subnit_button = st.button("submit") +if subnit_button: + st.session_state.test_history.append(text_input) + + st.write("you have submitted:", text_input) + st.session_state.input_box = "" # Clear the input box + +clear_button = st.button("clear history") +if clear_button: + st.session_state.test_history = [] + st.write("history cleared") +st.write("Past inputs") +for test in st.session_state.test_history: + st.write(test) \ No newline at end of file