0% found this document useful (0 votes)
2 views6 pages

Python for data science Day5

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 6

Python for Data Science: Learning Plan

Day Topics Covered Description Exercises/Problems

Overview of Python, installing


Python Basics: 1. Write a Python program to print your
Python and VS Code setup,
1 Setup, Syntax, name.\n2. Create variables for name,
basic syntax, comments,
and Variables age, and city, then print them.
variables, and data types

Day 1: Python Basics

Objective:
Understand Python’s purpose, how to set up your environment, and learn basic syntax,
comments, variables, and data types.

What Are We Using? Why and How?

• Python: A versatile, beginner-friendly programming language widely used in data


science for its simplicity and robust libraries.

• VS Code: A lightweight code editor that provides features like debugging and extensions
to work efficiently with Python.

Step 1: Setting Up Your Environment

1. Download Python from python.org.

2. Install VS Code and add the Python extension.

o Open VS Code, go to Extensions, search for "Python," and install it.

3. Test your setup by creating and running a simple program:

4. print("Hello, World!")

Step 2: Basic Syntax

• Python is indentation-sensitive, which means proper spacing is crucial. Indentation


replaces braces ({}) in Python.

• Comments are used to make code more readable and are ignored by Python during
execution:

• # This is a single-line comment

• """ This is a

• multi-line comment """


Step 3: Variables and Data Types

• Variables store data and can hold different data types.

• Python is dynamically typed, meaning you don’t need to declare variable types
explicitly:

• name = "Rajaaram" # String

• age = 25 # Integer

• is_learning = True # Boolean

• height = 5.8 # Float

Step 4: Basic Input/Output

• Use print() to display output on the screen:

• print("Welcome to Python!")

• Use input() to accept user input from the keyboard:

• user_name = input("Enter your name: ")

• print(f"Hello, {user_name}!")

Exercises for Day 1

1. Write a Python program to print your name.


Example output:

2. Rajaaram

3. Create variables for name, age, and city, then print them in a single statement using
string formatting:
Example code:

4. name = "Rajaaram"

5. age = 25

6. city = "Chennai"

7. print(f"My name is {name}, I am {age} years old, and I live in {city}.")

8. Write a program that takes your favorite color as input and prints:
Example input/output:

9. Enter your favorite color: Blue

10. Your favorite color is Blue


11. Create three variables: x, y, and z. Assign them values of 5, 10, and 15. Perform and print
the result of:

o Their sum

o Their product

o z divided by x

Example code:

x=5

y = 10

z = 15

# Perform calculations

sum_result = x + y + z

product_result = x * y * z

division_result = z / x

print(f"Sum: {sum_result}, Product: {product_result}, Division: {division_result}")

Let me know how this goes, and we’ll proceed to control structures (Day 2) next!

Python for Data Science: Learning Plan

Day Topics Covered Description Exercises/Problems

Overview of Python, installing


Python Basics: 1. Write a Python program to print your
Python and VS Code setup,
1 Setup, Syntax, name.\n2. Create variables for name,
basic syntax, comments,
and Variables age, and city, then print them.
variables, and data types

Day 1: Python Basics

Objective:
Understand Python’s purpose, how to set up your environment, and learn basic syntax,
comments, variables, and data types.

What Are We Using? Why and How?


• Python: A versatile, beginner-friendly programming language widely used in data
science for its simplicity and robust libraries.

• VS Code: A lightweight code editor that provides features like debugging and extensions
to work efficiently with Python.

Step 1: Setting Up Your Environment

1. Download Python from python.org.

2. Install VS Code and add the Python extension.

o Open VS Code, go to Extensions, search for "Python," and install it.

3. Test your setup by creating and running a simple program:

4. print("Hello, World!")

Step 2: Basic Syntax

• Python is indentation-sensitive, which means proper spacing is crucial. Indentation


replaces braces ({}) in Python.

• Comments are used to make code more readable and are ignored by Python during
execution:

• # This is a single-line comment

• """ This is a

• multi-line comment """

Step 3: Variables and Data Types

• Variables store data and can hold different data types.

• Python is dynamically typed, meaning you don’t need to declare variable types
explicitly:

• name = "Rajaaram" # String

• age = 25 # Integer

• is_learning = True # Boolean

• height = 5.8 # Float

Step 4: Basic Input/Output

• Use print() to display output on the screen:

• print("Welcome to Python!")
• Use input() to accept user input from the keyboard:

• user_name = input("Enter your name: ")

• print(f"Hello, {user_name}!")

Exercises for Day 1

1. Write a Python program to print your name.


Example output:

2. Rajaaram

3. Create variables for name, age, and city, then print them in a single statement using
string formatting:
Example code:

4. name = "Rajaaram"

5. age = 25

6. city = "Chennai"

7. print(f"My name is {name}, I am {age} years old, and I live in {city}.")

8. Write a program that takes your favorite color as input and prints:
Example input/output:

9. Enter your favorite color: Blue

10. Your favorite color is Blue

11. Create three variables: x, y, and z. Assign them values of 5, 10, and 15. Perform and print
the result of:

o Their sum

o Their product

o z divided by x

Example code:

x=5

y = 10

z = 15

# Perform calculations

sum_result = x + y + z

product_result = x * y * z

division_result = z / x
print(f"Sum: {sum_result}, Product: {product_result}, Division: {division_result}")

Let me know how this goes, and we’ll proceed to control structures (Day 2) next!

You might also like