2
immutable lists
a sequence of zero or more values (just like lists)
addressable by index (just like lists)
iterable (just like lists)
Use ()
to create a new tuple:
Empty tuple:
tuples
are immutableNo assignment is allowed
low_high
x
and y
sum_and_multiplication
dictionary
as argumentdef sum_and_multiplication(dictionary):
total = 0
multiplication = 1
for key in dictionary:
total += dictionary[key]
multiplication *= dictionary[key]
return total, multiplication
def main():
test_dict = {"a": 2, "b": 3, "c": 5}
total, mult = sum_and_multiplication(test_dict)
assert total == 10
assert mult == 30
main()
You have 10 minutes to complete the quiz
main()
, no need for test casesAllowed built-in functions: round()
, input()
, float()
, str()
, int()
, len()
, range()
, open()
odds_and_evens
integers
as argumentintegers
, and another with all the even numbers in integers