---
# System prepended metadata

title: Module 1 - Python Basics

---

# Module 1 - Python Basics

:::info
Learning objectives

* Demonstrate an understanding of types in Python by converting or casting data types such as strings, floats, and integers.
* Interpret variables and solve expressions by applying mathematical operations.
* Describe how to manipulate strings by using a variety of methods and operations.
* Build a program in JupyterLab to demonstrate your knowledge of types, expressions, and variables.
* Work with, manipulate, and perform operations on strings in Python.
:::

> Introduction to Python

1. It's clear and readable syntax.
2. It has a huge global community and a wealth of documentation.
3. It has library for data science.

> Getting Started with Jupyter

The video helps us to know how to use Jupyter notebook

> Hands-on Lab: Write Your First Program

- [First Python Code](https://github.com/jacksonchen1998/IBM-PY0101EN-Python-Basics-for-Data-Science/blob/main/Module_1/writing_your_first_python_code.ipynb)

> Types

This video introduces data type in Python and how to change data type.

Integer, float, boolean.

> Hands-on Lab: Types

- [Types of Data](https://github.com/jacksonchen1998/IBM-PY0101EN-Python-Basics-for-Data-Science/blob/main/Module_1/working_with_types_in_python.ipynb)

> Practice Quiz: Types

1. What is the data type of the entity 43?
    :::spoiler Answer
    `int`
    :::
2. What data type does 3.12323 represent?
    :::spoiler Answer
    `float`
    :::
3. What is the result of the following: int(3.99)?
    :::spoiler Answer
    `3`
    :::
    
> Expressions and Variables

This video introduces both expression and variable.

> Hands-on Lab: Expression and Variables

- [Variables and Expressions](https://github.com/jacksonchen1998/IBM-PY0101EN-Python-Basics-for-Data-Science/blob/main/Module_1/working_with_variables_and_expressions_in_python.ipynb)

> Practice Quiz: Expressions and Variables

1. What is the result of the following operation? 11//2
    :::spoiler Answer
    `5`
    :::
2. What is the value of x after the following is run?
    :::spoiler Answer
    `2.0`
    :::
3. Which line of code will perform the action as required for implementing the following equation?
    $y = 2x^2 - 3$
    :::spoiler Answer
    `y = 2 * x * x - 3`
    :::
     
> String Operations

1. **Strings in Python** – A sequence of characters enclosed in quotes, supporting spaces, digits, and special characters.  
2. **Indexing & Slicing** – Access characters using positive or negative indices; slicing extracts parts of the string.  
3. **Operations** – Strings support concatenation (`+`), replication (`*`), and length retrieval (`len()`).  
4. **Immutability** – Strings can't be modified in place; changes create a new string.  
5. **Escape Sequences** – `\n` (new line), `\t` (tab), `\\` (backslash), and raw strings (`r"string"`) for ignoring escape sequences.  
6. **String Methods** – `.upper()` (uppercase), `.replace()` (substring replacement), `.find()` (search substring).

> Hands-On Lab: String Operations

- [String](https://github.com/jacksonchen1998/IBM-PY0101EN-Python-Basics-for-Data-Science/blob/main/Module_1/string_operations.ipynb)

> Practice Quiz: Expressions and Variables

1. What is the result of the following? `Name[-1]`
    `Name = "Michael Jackson"`
    :::spoiler Answer
    `n`
    :::
2. What is the result of the following? `print("AB\nC\nDE")`
    :::spoiler Answer
    `AB`
    `C`
    `DE`
    :::
3. What is the result of following? `"hello Mike".find("Mike")`
    :::spoiler Answer
    `6`
    :::