Spaces:
Sleeping
Sleeping
File size: 489 Bytes
d97a106 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import streamlit as st
# 示例数据
data = {
"Player": ["Alice", "Bob", "Charlie"],
"Score": [100, 95, 90]
}
# 将数据转换为 Markdown 格式的字符串
def create_leaderboard(data):
leaderboard = "### Leaderboard\n"
for i, (player, score) in enumerate(zip(data["Player"], data["Score"]), start=1):
leaderboard += f"{i}. **{player}**: {score} points\n"
return leaderboard
# 在 Streamlit 应用中显示排行榜
st.markdown(create_leaderboard(data))
|