Lab Projects
PythonReact/Next.jsBlogAbout
Back to List

Hello World Experiment

This is the simplest Python experiment. You can enter your name and the program will greet you.

Python Code:
def hello(name: str) -> str:
    """Greet the specified person"""
    return f"Hello, {name}!"

# Usage Example
result = hello("World")
print(result)  # Output: Hello, World!
Try it out:
💡 Learning Points:
  • Function Definition: Use def keyword to define a function

  • Type Annotation: name: str and -> str provide type hints

  • f-string: Use f"" for string formatting

  • API Call: Click "Call API" button sends requests to the FastAPI backend