fizzbuzzのコードを書いてください
To upload files, please first save the app
import streamlit as st
st.title("FizzBuzz Game")
number = st.number_input("Enter a number", min_value=1, value=1)
def fizzbuzz(n):
if n % 15 == 0:
return "FizzBuzz"
elif n % 3 == 0:
return "Fizz"
elif n % 5 == 0:
return "Buzz"
else:
return str(n)
if st.button("Play FizzBuzz"):
result = fizzbuzz(number)
st.write(f"Result: {result}")
st.markdown("""
### Rules:
- If the number is divisible by 3, output "Fizz"
- If the number is divisible by 5, output "Buzz"
- If the number is divisible by both 3 and 5, output "FizzBuzz"
- Otherwise, output the number itself
""")
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?