Spaces:
Sleeping
Sleeping
Download examples/python_stdin.py from fariasultanacodes/isolated-sandbox: direct link, hf CLI and curl.
- Browser
- Download file 331 Bytes
-
https://huggingface.co/spaces/fariasultanacodes/isolated-sandbox/resolve/main/examples/python_stdin.py
- Command line
-
hf download hf://spaces/fariasultanacodes/isolated-sandbox/examples/python_stdin.py
-
curl -L -o python_stdin.py https://huggingface.co/spaces/fariasultanacodes/isolated-sandbox/resolve/main/examples/python_stdin.py
331 Bytes
| # Python Example: Input and Output | |
| name = input("What is your name? ") | |
| age = int(input("How old are you? ")) | |
| print(f"Hello {name}!") | |
| print(f"You will be {age + 1} next year!") | |
| # Calculate factorial | |
| def factorial(n): | |
| if n <= 1: | |
| return 1 | |
| return n * factorial(n - 1) | |
| print(f"Factorial of {age} is {factorial(age)}") |