Day 1 Introduction To Python
Day 1 Introduction To Python
Day 1 Introduction To Python
Features:
Basic Syntax
Variables:
Data Types:
Operators:
Arithmetic: +, -, *, /, %
Comparison: ==, !=, >, <, >=, <=
Logical: and, or, not
Control Structures
Conditionals:
python
Copy code
if condition:
# code
elif another_condition:
# code
else:
# code
Example:
python
Copy code
x = 10
if x > 5:
print("x is greater than 5")
else:
print("x is not greater than 5")
Loops:
For Loop:
python
Copy code
for i in range(5):
print(i)
While Loop:
python
Copy code
count = 0
while count < 5:
print(count)
count += 1
Day 1: Introduction to Python
Python Installation and Setup: To get started with Python, we recommend installing
Anaconda, a Python distribution that includes popular libraries for data science and machine
learning. Anaconda also comes with Jupyter Notebooks, an interactive computing
environment perfect for experimenting with Python code.
Basic Syntax: Python syntax is straightforward and easy to learn. Here are some basic
concepts:
Variables: Variables are used to store data. They can hold different types of data such
as numbers, strings, lists, etc.
Data Types: Python supports various data types including integers, floats, strings,
booleans, etc.
Operators: Python provides arithmetic operators (+, -, *, /), comparison operators (==,
!=, <, >), logical operators (and, or, not), etc.
Control Structures: Control structures allow us to control the flow of execution in our
programs:
Conditionals: Python supports if, elif, and else statements for decision-making.
Loops: Python provides for and while loops for iteration.
For example:
Output:
This program prompts the user for their name and greets them accordingly.