Skip to content
Snippets Groups Projects
Commit 4def0f96 authored by cprutean's avatar cprutean
Browse files

Upload New File

parent beca5de4
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id:11abbeeb tags:
# Extract Sublist
%% Cell type:code id:8da6771d tags:
``` python
"""
Extract a sublist and add list together
"""
def main():
# Make two lists
a_list = [1,2,3,4,5,6,7,8]
b_list = [9,10,11,12,13]
# Make a third list being a_list + elements 3,4,5 of b_list
c_list = a_list + b_list[3:6]
print("The c_list is : " + str(c_list) + " of length " + str(len(c_list)))
# Make a fourth list being elements 4:end of a + 0,1,2 of list b
d_list = a_list[4:] + b_list[:3]
print("The d_list is : " + str(d_list) + " of length " + str(len(d_list)))
main()
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment