Python for data science Day5
Python for data science Day5
Python for data science Day5
Objective:
Understand Python’s purpose, how to set up your environment, and learn basic syntax,
comments, variables, and data types.
• VS Code: A lightweight code editor that provides features like debugging and extensions
to work efficiently with Python.
4. print("Hello, World!")
• Comments are used to make code more readable and are ignored by Python during
execution:
• """ This is a
• Python is dynamically typed, meaning you don’t need to declare variable types
explicitly:
• age = 25 # Integer
• print("Welcome to Python!")
• print(f"Hello, {user_name}!")
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"
8. Write a program that takes your favorite color as input and prints:
Example input/output:
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
Let me know how this goes, and we’ll proceed to control structures (Day 2) next!
Objective:
Understand Python’s purpose, how to set up your environment, and learn basic syntax,
comments, variables, and data types.
• VS Code: A lightweight code editor that provides features like debugging and extensions
to work efficiently with Python.
4. print("Hello, World!")
• Comments are used to make code more readable and are ignored by Python during
execution:
• """ This is a
• Python is dynamically typed, meaning you don’t need to declare variable types
explicitly:
• age = 25 # Integer
• print("Welcome to Python!")
• Use input() to accept user input from the keyboard:
• print(f"Hello, {user_name}!")
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"
8. Write a program that takes your favorite color as input and prints:
Example input/output:
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!