Day 1 - Introduction to Python Programming
Day 1 - Introduction to Python Programming
Programming
1.1 What is Programming?
Programming is the process of writing instructions that tell a computer
how to perform a task. These instructions are written in programming
languages such as Python, Java, or C++.
Real-Life Example:
Think of programming like telling a robot to clean your house. You would
give it step-by-step instructions like:
● Pick up the vacuum,
● Move to the kitchen,
● Vacuum the floor, and so on. The robot doesn’t know what to do until
you tell it (through code).
1.2 Why Do We Need Programming?
Programming is essential because it allows us to make computers do
useful things—from solving complex problems to automating simple
tasks.
Uses of Programming:
1. Automation: You can automate repetitive tasks, like sending emails
or organizing files.
2. Problem-Solving: Programming helps solve mathematical,
engineering, or data analysis problems.
3. Creating Websites: Programming is used to create web pages and
apps that we use every day.
4. Building Software: Programming is used to create everything from
video games to business applications.
1.3 Where and How is Programming Used?
1. After clicking the search result, you should see a Download button for Python..
○ This download page should show a button labeled "Download Python".
○ Click that button to start the download.
2. Once the download is complete, locate the downloaded file (typically in the Downloads
folder).
Step 4: Run the Python Installer
1
Step 5: Verify Python Installation
After the installation is complete, let's check if Python was installed correctly.
2
Installing VS Code:
2
3
4
Using VS Code for Python
● Install the Python extension by clicking on the Extensions icon (four
squares) on the left sidebar.
1. create a new file by selecting File > New File.
2. Select Python File
3. Write the code print(‘Hello, World!’)
4. save the file with any name ex: first program.py (Important: py is python
extension)
5. To run the program, you can use shortcut f5 or go to run > start debugging
or with play button in the right side of the screen
6
1
3
2
4
5
● If used f5 or run > start debugging, Select Python
Debugger > Python File
(Output)
Answer: c
1.6 Understanding Python Syntax
What is Syntax?
Syntax is the set of rules that tell Python how to understand your instructions. If you make a
mistake in your syntax, Python will show an error.
Explanation:
A variable is like a box that holds information. You can store data in a variable
and give it a name so you can refer to it later.
A) 1st_variable
B) first_variable
C) first-variable
D) first variable
MCQ
What is a valid variable name in Python?
A) 1st_variable
B) first_variable
C) first-variable
D) first variable
B) first_variable
MCQ
What is a variable in Python?
a) A function to print data
b) A way to store data in memory
c) A method to execute Python scripts
d) A type of Python file
MCQ
What is a variable in Python?
a) A function to print data
b) A way to store data in memory
c) A method to execute Python scripts
d) A type of Python file
Answer: b
MCQ
Which of the following is a correct variable assignment?
a) x = 5
b) 5 = x
c) x =
d) x == 5
MCQ
Which of the following is a correct variable assignment?
a) x = 5
b) 5 = x
c) x =
d) x == 5
Answer: a
Exercise
Create three variables: x, y, and z, and assign the values 10,
5.5, and "Hello" to them respectively. Print the values of all
three variables on separate lines.
Exercise Solution
x = 10
y = 5.5
z = "Hello"
print(x)
print(y)
print(z)
Assigning values to variables
● Left side is variable name
● Right side is value and value can be any anything
○ Ex: string(letters, words, sentence),
integer(number) etc.
Multi Words Variable Names
Variable names with more than one word can be difficult to read.
There are several techniques you can use to make them more readable:
Camel Case
Pascal Case
Snake Case