Spaces:
Runtime error
Runtime error
Download dice.py from asgface/fplChatbot: direct link, hf CLI and curl.
- Browser
- Download file 521 Bytes
-
https://huggingface.co/spaces/asgface/fplChatbot/resolve/main/dice.py
- Command line
-
hf download hf://spaces/asgface/fplChatbot/dice.py
-
curl -L -o dice.py https://huggingface.co/spaces/asgface/fplChatbot/resolve/main/dice.py
521 Bytes
| import random | |
| def roll_dice(): | |
| return random.randint(1, 6) | |
| def main(): | |
| print("Welcome to the dice roller!") | |
| while True: | |
| print("Enter 'q' to quit.") | |
| user_input = input("Roll the dice? ") | |
| if user_input.lower() == 'q': | |
| break | |
| else: | |
| try: | |
| result = roll_dice() | |
| print(f"You rolled a {result}!") | |
| except ValueError: | |
| print("Invalid input, please enter a number.") | |
| if __name__ == "__main__": | |
| main() |