Skip to content

Commit c221845

Browse files
committed
Changes in 01
1 parent 4cd4f7f commit c221845

File tree

3 files changed

+37
-22
lines changed

3 files changed

+37
-22
lines changed

01.Variables/README.md

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,40 @@ Welcome to the Python Variables section! In this section, you'll learn about the
1010
## 📚 Table of Contents
1111

1212
- [Variables](#-variables)
13-
- [String Variables](#-string-variables)
14-
- [Float Variables](#-float-variables)
15-
- [Integer Variables](#-integer-variables)
16-
- [Boolean Variables](#-boolean-variables)
13+
- [Datatype](#-data-type)
14+
- [String Dataype](#-string-datatype)
15+
- [Float Dataype](#-float-datatype)
16+
- [Integer Dataype](#-integer-datatype)
17+
- [Boolean Dataype](#-boolean-datatype)
1718
## 📚 Variables
1819

1920
Variables are containers for storing data values. In Python, you don't need to declare the type of a variable, as Python is dynamically typed. This means you can assign different types of values to the same variable.
2021

21-
## 📜 String Variables
22-
23-
- In this section, you'll learn about string variables in Python, including how to create them, perform operations like concatenation, slicing, and more.
22+
```python
23+
a = 1
24+
b = True
25+
c = "Vibhav"
26+
d = None
27+
```
28+
- These are four variables of different data types.
29+
---
30+
## 📊 Data Type
31+
Data type specifies the type of value a variable holds. This is required in programming to do various operations without causing an error.
32+
In python, we can print the type of any operator using type function:
33+
```python
34+
a = 1
35+
print(type(a))
36+
b = "1"
37+
print(type(b))
38+
```
2439

25-
### What is a String Variable?
40+
## 📜 String Datatype
2641

27-
- A string variable is used to store text data. In Python, you can create a string variable by enclosing text in single quotes (`'`) or double quotes (`"`). Strings are immutable, meaning that once a string is created, it cannot be changed.
42+
- A string is used to store text data. In Python, you can create a string variable by enclosing text in single quotes (`'`) or double quotes (`"`). Strings are immutable, meaning that once a string is created, it cannot be changed.
2843

29-
### Creating String Variables
44+
### Creating String Datatype
3045

31-
- You can create a string variable by assigning a string to a variable name.
46+
- You can create a string by assigning a string to a variable name.
3247

3348
```python
3449
# Example of creating string variables
@@ -80,13 +95,13 @@ print(greeting.replace("World", "Python")) # Output: Hello, Python!
8095
print(greeting.split(", ")) # Output: ['Hello', 'World!']
8196
```
8297

83-
# 🔬 Float Variables
98+
# 🔬 Float Datatype
8499

85-
- A float variable is used to store numbers with a decimal point. Floats are useful when you need precision for calculations involving fractions or when you need to represent real numbers.
100+
- A float is used to store numbers with a decimal point. Floats are useful when you need precision for calculations involving fractions or when you need to represent real numbers.
86101

87-
### Creating Float Variables
102+
### Creating Float Datatype
88103

89-
- You can create a float variable by assigning a number with a decimal point to a variable name.
104+
- You can create a float by assigning a number with a decimal point to a variable name.
90105

91106
```python
92107
# Example of creating float variables
@@ -151,11 +166,11 @@ print(ceiling_value) # Output: 4
151166
print(floor_value) # Output: 3
152167
```
153168

154-
# 🔢 Integer Variables
169+
# 🔢 Integer Datatype
155170

156-
An integer variable is used to store whole numbers (without a decimal point). Integers can be both positive and negative. They are commonly used for counting and indexing.
171+
An integer is used to store whole numbers (without a decimal point). Integers can be both positive and negative. They are commonly used for counting and indexing.
157172

158-
### Creating Integer Variables
173+
### Creating Integer Datatype
159174

160175
- You can create an integer variable by assigning a whole number to a variable name.
161176

@@ -222,13 +237,13 @@ string_number = "123"
222237
integer_number = int(string_number)
223238
print(integer_number) # Output: 123
224239
```
225-
# ✅ Boolean Variables
240+
# ✅ Boolean Datatype
226241

227-
A boolean variable is used to store one of two values: `True` or `False`. Booleans are often used in conditional statements and loops to control the flow of a program.
242+
A boolean is used to store one of two values: `True` or `False`. Booleans are often used in conditional statements and loops to control the flow of a program.
228243

229-
### Creating Boolean Variables
244+
### Creating Boolean Datatype
230245

231-
- You can create a boolean variable by assigning `True` or `False` to a variable name.
246+
- You can create a boolean by assigning `True` or `False` to a variable name.
232247

233248
```python
234249
# Example of creating boolean variables

assets/variables-datatype.png

109 KB
Loading

assets/variables.png

-107 KB
Binary file not shown.

0 commit comments

Comments
 (0)