Skip to content

Commit 3a4cd45

Browse files
committed
day 2
1 parent e543119 commit 3a4cd45

File tree

3 files changed

+501
-5
lines changed

3 files changed

+501
-5
lines changed

Week 1/Day 1/notes and codes.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
|4-2|Numeric Data Type|[Click Here](#4-2-numeric-data-type)|
2020
|4-3|Boolean & None Data Type|[Click Here](#4-3-boolean-and-none-data-type)|
2121
|4-4|Collection Data Type|[Click Here](#4-4-collection-data-type)|
22+
|5|Summary|[Click Here](#summary)|
2223

2324

2425
## Intro to Python
@@ -226,3 +227,28 @@ The main collection types are:
226227
```
227228
228229
**[🔝Index](#index)**
230+
231+
## Summary
232+
233+
Today, we began our journey with Python by exploring the fundamental concepts every beginner should know:
234+
235+
- **Introduction to Python**
236+
Python is a beginner-friendly, high-level programming language known for its clean syntax and readability. It's widely used in fields like data science, automation, and web development.
237+
238+
- **Defining Variables**
239+
Variables are used to store data. Python uses the `=` operator for assignment and infers data types automatically (dynamic typing).
240+
241+
- **Variable Naming Rules**
242+
Variable names must start with a letter or underscore, cannot include spaces or special characters, and are case-sensitive. Keywords like `if` or `class` cannot be used as variable names.
243+
244+
- **Data Types Overview**
245+
Python supports several built-in data types:
246+
- **String (`str`)**: Text data
247+
- **Numeric Types**: Integers, floats, and complex numbers
248+
- **Boolean (`bool`)**: True/False values
249+
- **NoneType (`None`)**: Represents no value
250+
- **Collections**: Lists, tuples, sets, and dictionaries (covered partially today)
251+
252+
This foundation will help you write clean, readable, and effective Python code in upcoming lessons.
253+
254+
**[🔝Index](#index)**

Week 1/Day 2/assignment.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Python for Beginners — Day 2 Assignment
2+
3+
**Prepared by:** [Shubham](https://github.com/Shubham-S151)
4+
🎥 *From the [Bit and Pi](https://www.youtube.com/@BitandPi) YouTube Channel*
5+
6+
---
7+
8+
## Topics Covered Today
9+
10+
- What is a String in Python?
11+
- Creating Strings
12+
- Basic String Operations
13+
- Indexing and Slicing
14+
- String Methods
15+
- String Formatting
16+
- Escape Characters and Raw Strings
17+
18+
---
19+
20+
## Assignment Instructions
21+
22+
- Complete the questions below in a Python file or a Jupyter notebook.
23+
- Submit your work as `.py`, `.ipynb`, or `.pdf` format.
24+
- Try to write comments in your code to explain your logic.
25+
26+
---
27+
28+
## Part A — Theory Questions
29+
30+
Answer the following in brief (1–2 lines each):
31+
32+
1. What is a string in Python? How is it different from a character in C?
33+
2. Are strings mutable in Python? Explain with an example.
34+
3. What is the difference between `.find()` and `.index()` methods?
35+
4. What are raw strings? Give an example.
36+
5. What are f-strings and why are they useful?
37+
38+
---
39+
40+
## Part B — Coding Exercises
41+
42+
### 1. **String Creation**
43+
44+
- Create 3 different strings using:
45+
- Single quotes
46+
- Double quotes
47+
- Triple quotes (multiline)
48+
49+
### 2. **Concatenation and Repetition**
50+
51+
- Concatenate two strings: `"Hello"` and `"World"`
52+
- Repeat the string `"ha"` 4 times
53+
54+
### 3. **String Indexing and Slicing**
55+
56+
Given `s = "Python Programming"`:
57+
58+
- Print the first character
59+
- Print the last character
60+
- Slice `"Python"` from the string
61+
- Print the string in reverse
62+
- Print every second character
63+
64+
### 4. **Using String Methods**
65+
66+
Given `text = " Learn Python Programming "`:
67+
68+
- Convert the text to lowercase
69+
- Remove extra spaces from both sides
70+
- Replace `"Python"` with `"C++"`
71+
- Count how many times `"a"` appears
72+
73+
### 5. **Splitting and Joining**
74+
75+
Given: `sentence = "Python is easy to learn"`
76+
77+
- Split the sentence into a list of words
78+
- Join the list back into a single string using `-` as a separator
79+
80+
### 6. **String Formatting**
81+
82+
- Use all 3 string formatting methods (`f-string`, `.format()`, and `%`) to print:
83+
`"Hello, my name is Alex and I am 30 years old."`
84+
85+
### 7. **Escape Characters**
86+
87+
- Print:
88+
```bash
89+
Name: Alice
90+
Age: 25
91+
Location: New York\tUSA
92+
```
93+
94+
### To Acess the solution visit : [Click_here](https://gist.github.com/Bit-and-Pi/3a86f0a405fa583644403dcbf06a7591)

0 commit comments

Comments
 (0)