Skip to content

Commit 80ce728

Browse files
committed
python course
1 parent 7e26878 commit 80ce728

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

Lists.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
a=[1,2,5,1,546] #lists are same as arrays in javascript
2+
print(a) #a is "int" list (integers).
3+
print(a[4]) #for print particuler one index
4+
# we change the value of particuler position
5+
a[2]=3
6+
a[3]=4
7+
a[4]=5
8+
#now list will look like: [1,2,3,4,5]
9+
print(a)
10+
b=[True,False,True,True] #list of booleans "bol"
11+
print(b)
12+
print(b[1])#for print particuler one index
13+
# same as "int" list you can value or boolean "bol" list
14+
#example change index[1] "false" to "true"
15+
b[1]=True
16+
print(b) #now all list of "bol" is "true" value
17+
print(len(b)) #Length can also check by len(). function
18+

README.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,14 @@
148148
**List Indexing**
149149
-- Index is always same in every case:
150150
- it will start from number "0".
151-
- It will stop at length-1 index number.
151+
- It will stop at length-1 index number.
152+
153+
**Can change value of list**
154+
-- Answer is Yes!
155+
- a=[1,2,4,3] --> for change value you index of that place where you want to change
156+
- a[2]=3 --> now "4" will change with "3"
157+
- a[3]=4 --> now "3" will change with "4"
158+
159+
**Can string Functions can implemen in Lists?**
160+
-- Answer is Yes! but not all of them
161+
- Len() to find length of list.

0 commit comments

Comments
 (0)