[1, 'a', 2.0, False]
FalseCSCI 1012
ex1.pyex2.pyex3.py.zip with all the .py files
check_even.py vs. checkEven.pydef check_even(x): vs. def check_evens(x):1  2  3 vs. 1 2 3Read your autograder output!
Recall with strings:
< and >
'a' is “less than” 'b''b' is “less than” 'c''b' is not less than 'C'
Write a function ex1 that takes a string and finds the “lowest” character, alphabetically, in the string, and returns that character:
ex1('hello') returns 'e'ex1('cat') returns 'a'ex1('pool') returns 'l'Assume that every character in the string will be a lower case letter. Submit as ex1.py.
[1, 'a', 2.0, False]
FalseSimilar to strings:
a
['the', 2.0]Looping:
Strings can’t be changed in place:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'str' object does not support item assignment
Lists can be changed in place:
['m', 'o', 'r', 't', 'i', 'f', 'y'][1, 3, 2]
[1, 3, 2, 4].append changes the list=[1, 3, 2, 4, 'b']
5We saw how to ‘build’ strings:
s = ""
for j in range(1, 8):
  if j % 3 == 0:
    s = s + "🙃"
  else:
    s = s + str(j)
  if j != 7:
    s = s + "_"
print(s)1_2_🙃_4_5_🙃_7We can ‘build’ lists, too:
[1, 3, 5, 7, 9, 11, 13, 15, 17, 19]No reassignment to A
Lists: append with .append method
Strings: concatenate with +=
Lists concatenate with + operator:
['a', 2, 3, 'b']
['a', 2, 3, 'b', 0]Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: can only concatenate list (not "int") to listWrite a function ex2 that takes one argument, a list of numbers, and returns the smallest number in the list. Don’t use built-in min, max, or any function that sorts for you.
ex2([1, 2, 3]) returns 1ex2([1, 0, 2, 0]) returns 0ex2([5, 4, 3, -2, 1]) returns -2Submit as ex2.py
E = [1, 5, 4, -3, 2, 8]
print("min:", min(E))
print("max:", max(E))
print("sorted:", sorted(E))
print("3 in E?", 3 in E)
print("7 in E?", 7 in E)
print("E dot sort:", E.sort())min: -3
max: 8
sorted: [-3, 1, 2, 4, 5, 8]
3 in E? False
7 in E? False
E dot sort: NoneNone 😐😐😐None 😐😐😐M: 9
K: 5def another(L):
  L = L + L[-1] + L[-1]
  return L
K = "strings are immutable"
M = another(K)
print("M:", M)
print("K:", K)M: strings are immutableee
K: strings are immutabledef another(L):
  L.append(L[-1])
  return L
K = ["first", "second", "last"]
M = another(K)
print("M:", M)
print("K:", K)M: ['first', 'second', 'last', 'last']
K: ['first', 'second', 'last', 'last']s = "trivial"
print("first:", s[3:7]) # slicing a string
B = [1, 2, 3]
print("second:", B[1:]) # slicing a list
C = ["house", "boat"]
print("third:", C[1][1:4]) # multiple indexing
D = [[1, 2, 3], [4, 5, 6], [7, 8, 9, [10, 11, 12]]] # nested lists
print("fourth:", D[2][3][1:][0])first: vial
second [2, 3]
third: oat
fourth: 11Write a function ex3 that takes a list of numbers and returns a new list, identical to the old list, but with the smallest number in the original list appended to the end. Do not modify the original list.
Examples:
ex3([0, 1, 2]) returns [0, 1, 2, 0]ex3([4, 1, 5, 1]) returns [4, 1, 5, 1, 1]ex3([2, 2]) returns [2, 2, 2]Submit as ex3.py