Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
zehengl committed Nov 2, 2023
1 parent e0943ae commit 5e0cb57
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions streamlit_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@ def get_tree_coverage_sample(df):

st.header("Questions")

score, total = 0, 6
score, ans = 0, []

df_area = get_area_sample(df)
ans_area = st.radio(
":blue[Which community has the largest area?]",
df_area["name"],
index=None,
)
ans.append(ans_area)
if ans_area in df_area["name"][df_area["area"] == df_area["area"].max()].tolist():
score += 1

Expand All @@ -77,6 +78,7 @@ def get_tree_coverage_sample(df):
df_bikeways["name"],
index=None,
)
ans.append(ans_bikeways)
if (
ans_bikeways
in df_bikeways["name"][
Expand All @@ -91,6 +93,7 @@ def get_tree_coverage_sample(df):
df_schools["name"],
index=None,
)
ans.append(ans_schools)
if (
ans_schools
in df_schools["name"][df_schools["schools"] == df_schools["schools"].max()].tolist()
Expand All @@ -103,6 +106,7 @@ def get_tree_coverage_sample(df):
df_recreation_facilities["name"],
index=None,
)
ans.append(ans_recreation_facilities)
if (
ans_recreation_facilities
in df_recreation_facilities["name"][
Expand All @@ -118,6 +122,7 @@ def get_tree_coverage_sample(df):
df_transit_stops["name"],
index=None,
)
ans.append(ans_transit_stops)
if (
ans_transit_stops
in df_transit_stops["name"][
Expand All @@ -132,6 +137,7 @@ def get_tree_coverage_sample(df):
df_tree_coverage["name"],
index=None,
)
ans.append(ans_tree_coverage)
if (
ans_tree_coverage
in df_tree_coverage["name"][
Expand All @@ -140,18 +146,13 @@ def get_tree_coverage_sample(df):
):
score += 1

total = len(ans)
if score == total:
thumb = ":100:"
else:
thumb = ":thumbsup:" if score / total > 0.4 else ":thumbsdown:"

if all(
[
ans_area,
ans_bikeways,
ans_schools,
]
):
if all(ans):
st.write(f"You score {score} out of {total} {thumb}")


Expand Down

0 comments on commit 5e0cb57

Please sign in to comment.