Introduction to Python: Your First Program
Techverse by Vijay
Coding Tutorial
Introduction to Python: Your First Program
Python is a beginner-friendly programming language widely used in web development, data science, automation, and AI. This guide will help you write your first Python program and understand basic syntax.
Step 1: Install Python
Download and install Python from the official website: python.org. Make sure to check the option "Add Python to PATH" during installation.
Step 2: Write Your First Program
Open your code editor (like VS Code) or Python IDLE and type the following:
print("Hello, World!")
This program prints "Hello, World!" to the screen.
Step 3: Run the Program
Save your file as hello.py. Open a terminal or command prompt and run:
python hello.py
You should see Hello, World! printed.
Step 4: Understanding the Code
- print(): Function to display text on the screen.
- Text inside quotes ("") is a string.
Step 5: Next Steps
Try experimenting with:
print("Python is fun!")
print("2 + 3 =", 2+3)
These examples demonstrate basic strings, numbers, and simple arithmetic.
Conclusion
Congratulations! You have written and run your first Python program. From here, you can explore variables, loops, functions, and more advanced Python features.
Comments
Post a Comment