At the top of each of your scripts, put the following multi-line comment with your information:
'''
Your name as registered, with optional nickname in parentheses
CIS 41A Fall 2021
Unit C, Problem C
'''
1,3,5
1,2,3,4
+
operator). in
to test list3 to see if it contains a 3
,
print True/False result (do with one line of code).
3
s in list3, print the result. 3
in list3, print the result. 3
and assign it to a variable called first3,
print first3.
sorted
built-in function.
1,2,3
from the middle
of list3, print the result.
sort
method), print list3. 4
contained within list5. Example output:
d) Items in list1: 1 5 3 g) list3 is: [1, 5, 3, 1, 2, 3, 4] h) list3 contains a 3: True i) list3 contains 2 3s j) The index of the first 3 contained in list3 is 2 k) first3 = 3 m) list3 is now: [1, 5, 1, 2, 3, 4] n) list4 is: [1, 1, 2, 3, 4, 5] o) Slice of list3 is: [1, 2, 3] p) Length of list3 is 6 q) The max value in list3 is 5 r) Sorted list3 is: [1, 1, 2, 3, 4, 5] t) list5 is: [[1, 5, 3], [1, 2, 3, 4]] u) Value 4 from list5: 4
9
and 14
to variables a and b respectively. Example output:
b) binary of a = 0b1001 b) binary of b = 0b1110 c) binary of a & b = 0b1000 d) binary of a | b = 0b1111
Add the following at the end of each script to show your results:
'''
Execution results:
paste execution results here
'''
Submit both your finished py scripts in Canvas, Problem C.