Here’s a very basic example of an AI program using Python. This program asks the user for their name and then greets them:
python# Very basic AI program in Python def main(): # Ask the user for their name name = input("What's your name? ") # Greet the user print(f"Hello, {name}! Welcome to the AI program.") if __name__ == "__main__": main()
Copy and paste this code into a Python file (e.g., `basic_ai.py`) and run it using a Python interpreter. When you run the program, it will prompt you to enter your name and then greet you with a personalized message.
This is just a simple example, and AI programs can become much more complex and sophisticated, involving machine learning, natural language processing, computer vision, and more. But it’s a good starting point to understand the basics of taking input, processing it, and providing output using a simple AI-like interaction.