gpt-4-0314· openai
Suzhen/CodeChat
build a simple code in python coding language
- User
build a simple code in python coding language
- Assistant
Here's a simple Python code that takes user input for their name and age, and then prints out a greeting message:
# Get user input name = input("Please enter your name: ") age = int(input("Please enter your age: ")) # Generate a greeting message greeting = f"Hello, {name}! You are {age} years old." # Print the greeting message print(greeting)Copy and paste the code into a Python environment or a text file with the extension .py (example: simple_greeting.py) and then run it using a Python interpreter to see it in action. The code will prompt the user for their name and age, and then display a personalized greeting.