isolated-sandbox / examples /python_stdin.py
ChefAdorous's picture
Deploy Code Execution Sandbox with FastAPI and Docker
a89f25d
raw
history blame contribute delete
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)}")