Skip to content

Commit 3be3f69

Browse files
author
Holladworld
committed
copy a list object
1 parent cc4ce51 commit 3be3f69

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/python3
2+
def copy_list(l):
3+
return (l[:])
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/python3
2+
copy_list = __import__('19-copy_list').copy_list
3+
4+
my_list = [1, 2, 3]
5+
print(my_list)
6+
7+
new_list = copy_list(my_list)
8+
9+
print(my_list)
10+
print(new_list)
11+
12+
print(new_list == my_list)
13+
print(new_list is my_list)

0 commit comments

Comments
 (0)