0% found this document useful (0 votes)
28 views

Day 1 Introduction To Python

Uploaded by

Deep gaichor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Day 1 Introduction To Python

Uploaded by

Deep gaichor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Day 1: Introduction to Python

Overview of Python: History and Features


History:

 Created by: Guido van Rossum


 Released: 1991
 Named After: Monty Python's Flying Circus

Features:

 High-Level Language: Easy to read and write


 Interpreted: Executes code line by line
 Dynamically Typed: No need to declare variable types
 Object-Oriented: Supports OOP principles
 Extensive Libraries: Rich standard library and third-party modules
 Community Support: Large, active community

Python Installation and Setup


Installing Python:

1. Download Python from python.org


2. Install Anaconda for data science projects anaconda.com
3. Setup Jupyter Notebooks:
o Install via Anaconda: conda install jupyter
o Run Jupyter Notebook: jupyter notebook

Basic Syntax
Variables:

 Assign values with =


 Example: x = 10, name = "Alice"

Data Types:

 Numbers: int, float, complex


 Strings: 'Hello', "World"
 Booleans: True, False

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

Overview of Python: Python is a high-level, interpreted programming language known for


its simplicity and readability. It was created by Guido van Rossum and first released in 1991.
Python's features include:

 Interpreted: Python code is executed line by line by the Python interpreter.


 High-level: Python abstracts many low-level programming details, making it easier to
write and understand code.
 Dynamically typed: Variables in Python don't have explicit types and can change type
during execution.
 Versatile: Python is used in various domains such as web development, data science,
artificial intelligence, etc.

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:

# Example of a simple Python program


name = input("Enter your name: ")
if name == "Alice":
print("Hello, Alice!")
else:
print("Hello, " + name + "!")

Output:

Enter your name: Bob


Hello, Bob!

This program prompts the user for their name and greets them accordingly.

You might also like