You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Basic/VariableAndDataTypes.md
+6-7Lines changed: 6 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,8 +73,7 @@ print(c) #3
73
73
74
74
Here all three variable a, b, c are assigned to the same memory location
75
75
76
-
### Some rules while creating variable :pencil2:
77
-
76
+
### Some rules while creating variable
78
77
- Use variable naming convention means variable name related to real world example
79
78
```python
80
79
For example :person_name
@@ -86,10 +85,10 @@ Instead of: pn
86
85
- Do not use reserve keyword name as variable name like list,int, str.
87
86
88
87
89
-
### How to find out variable data type :telescope:
88
+
### How to find out variable data type
90
89
to find data type of already defined variable there is one default method called **type()**
91
90
92
-
Example :one:
91
+
Example 1
93
92
```python
94
93
a=5
95
94
print(type(a))
@@ -114,9 +113,9 @@ This will give you int result with a memory location.
114
113
115
114
116
115
117
-
### Global variable :globe_with_meridians:and local variable
116
+
### Global variable and local variable
118
117
- Every variable has its own scope depending upon variable declaration block
119
-
#### 1. Global Variable :globe_with_meridians:
118
+
#### 1. Global Variable
120
119
- Global variables are the one that are defined and declared outside a function, and we need to use them inside a function.
121
120
- If you defined a variable outside of function that can be accessible by other function so this is a global variable
122
121
Example
@@ -130,7 +129,7 @@ def foo():
130
129
foo()
131
130
```
132
131
133
-
#### 2. Local Variable :full_moon:
132
+
#### 2. Local Variable
134
133
- If a variable with same name is defined inside the scope of function as well, as it will print the value given inside the function only andnot the global value.
135
134
- If a variable inside a function this is a simple example of a local variable
136
135
- This variable is accessible only by that function where it defined
0 commit comments