Download (right-click, save target as ...) this page as a jupyterlab notebook from:
LAST NAME, FIRST NAME
R00000000
ENGR 1330 ES-4.1 - Homework
# Preamble script block to identify host, user, and kernel
import sys
! hostname
! whoami
print(sys.executable)
print(sys.version)
print(sys.version_info)
For the list given below, index and pick all the elements from index positions 3 to 10. Then, calculate the sum and the length of the elements from index positions 3 to 7. Print the sliced list and the values of the sum and the sliced list.
[22, 45, 54, 87, 10, 97, 88, 75, 99, 11, 19, 39, 47, 81, 84]
# Make the given list; then print the contents
# slice the list from positions 3 to 10 including 10; put the slice into a new list
# print the new list
# slice the new list above from positions 3 to 7 | including 7 ; put the slice into another new list
# print the another new list
# find the sum of the another new list
# find the length of the another new list
From the nested dictionary given below, index and pick the string 'hello'.
{'k1':[1,2,3,{'tricky':['oh','man','inception',{'target':[1,2,3,'hello']}]}]}
# create the dictionary, give it a name; use the curly bracket construction method
# lookup in the dictionary using keys and indices to find the object 'hello'