('J', '2')
Final exam
1pm: Monday May 12, 1:00 - 3:00pm, GITT 129B
2pm: Friday May 09, 1:00 - 3:00pm, GITT 129B
Bring your photo ID
string is not mutable, means every string method will return a new string
indexing a string
.isnumeric()
returns True if all the chars are numeric (0-9).lower()
returns a string with all lowercase chars
.strip()
removing chars in the beginning or end
.split()
return a list by splitting strings by charlist[index] = value
mutate a list value using index
.append(value)
append an item to the end of a list
.insert(index, value)
insert a value at index
.pop(index)
remove an item at index
.remove(value)
remove a value
.extend(list_b)
concatenate with another list
list[index_a:index_b]
list slicing
2D lists
dict[key] = value
mutate a value using key
dict[key] = value
add a new key-value pair
dict.pop(key)
remove a key-value pair using key
for k in dict:
iterate only the keys
for v in dict.values():
iterate only the values
for k, v in dict.items():
iterate both
Write a python function that does the following:
Its name is create_list
It takes two arguments, a set of strings and an integer n
It returns a list that contains each string from the set repeated n times
maximum
*values
values
Can we change the order of max == None
and v > max
?
No we CANNOT. Try it on your own laptop.