-
Hajipur, Bihar, 844101
Hajipur, Bihar, 844101
Introduction to Python
Python Basics
Python Syntax
Python Comments
Python Variables
Python Data Types
Python Casting
Python I/O
Python Operators
Cotrol Structures
Data Structures
Python Strings
Python Lists
Python Tuples
Python Dictionaries
Python Sets
Python Arrays
Python Bytes and Bytearray
Date and Time
Functions and Module
File Handling
Python OOP
Advanced Concepts
Python Scope
Python Modules
Python JSON
Python RegEx
Python PIP
Python Try...Except
Python String Formatting
Python User Input
Python VirtualEnv
Python Math
Python DSA
Python DSA
Lists and Arrays
Python Stacks
Python Queues
Linked Lists
Python Hash Tables
Python Trees
Python Binary Trees
Binary Search Trees
Python AVL Trees
Python Graphs
Searching Algorithms
Sorting Algorithms
Once Python is installed and your editor (IDLE or VS Code) is set up, it's time to write your first Python program.
Python is known for its simplicity and readable syntax. Let’s create a basic script that prints something on the screen — the traditional way to begin is with a Hello, World! program.
Open IDLE.
Click on File > New File.
Type the following code:
print("Hello, World!")
Save the file with a .py
extension (e.g., first_program.py
).
Press F5 to run the program.
Hello, World!
Open VS Code.
Create a new file named first_program.py
.
Type the same code:
print("Hello, World!")
Open the terminal inside VS Code (Ctrl +
`).
Run the file:
python first_program.py
Hello, World!
The print()
function is used to display output in Python.
It takes one or more arguments and writes them to the standard output (usually the screen).
Syntax:
print(object(s), sep=separator, end=end, file=file, flush=flush)
For now, just remember:
print("any message you want to show")
Mistake | Example | Fix |
---|---|---|
Missing quotes | print(Hello World) |
print("Hello World") |
Wrong function name | Print("Hello") |
print("Hello") (Python is case-sensitive) |
No parentheses (in Python 3) | print "Hello" |
print("Hello") |
print("Python is awesome!")
print("My name is John")
print(5 + 7)
Q1. Write a Python program to print "Welcome to Python Programming".
Q2. Write a Python program to print your name using the print()
function.
Q3. Write a Python program to print your age using the print()
function.
Q4. Write a Python program to display the result of 5 + 10.
Q5. Write a Python program to show the output of print(3 * 7)
.
Q6. Write a Python program that prints your city and country.
Q7. Write a Python program to print the sentence: "Python is easy to learn."
Q8. Write a Python program to print two numbers on the same line.
Q9. Write a Python program to display your favorite quote using print()
.
Q10. Write a Python program to print your full name using two separate print()
statements.
Introduction to Python
Python Basics
Python Syntax
Python Comments
Python Variables
Python Data Types
Python Casting
Python I/O
Python Operators
Cotrol Structures
Data Structures
Python Strings
Python Lists
Python Tuples
Python Dictionaries
Python Sets
Python Arrays
Python Bytes and Bytearray
Date and Time
Functions and Module
File Handling
Python OOP
Advanced Concepts
Python Scope
Python Modules
Python JSON
Python RegEx
Python PIP
Python Try...Except
Python String Formatting
Python User Input
Python VirtualEnv
Python Math
Python DSA
Python DSA
Lists and Arrays
Python Stacks
Python Queues
Linked Lists
Python Hash Tables
Python Trees
Python Binary Trees
Binary Search Trees
Python AVL Trees
Python Graphs
Searching Algorithms
Sorting Algorithms