Skip to content

Commit 5d27c99

Browse files
committed
list from scratch
1 parent bf47129 commit 5d27c99

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# We can create an empty list and then add elements using the append method
2+
3+
var = list() # creating an empty list
4+
var.append('apple') # adding 'apple' to the list through the append method
5+
# The list stays in order and new elements are added at the end of the list by default
6+
var.append(120) # adding 120 to the list through the append method
7+
print (var) # printing the list
8+
9+
10+
11+
var.append('Orange')
12+
var.append(180)
13+
print (var) # printing the list again after adding the above two new elements
14+

0 commit comments

Comments
 (0)