# Exercises¶

1. Create:

1. A tuple with two integers, 0 and 1.

2. A tuple with two strings, "a" and "tuple".

3. A tuple with only one element, "a tuple".

Hint: you can either use the syntax presented at the beginning of the chapter, or use a list-tuple conversion.

4. A tuple with the integers between 0 and 99.

Hint: is there some way to exploit the range() function?

2. Given l = [0, 1, 2] and t = (0, 1, 2), what is the difference between:

1. First case:

x = l
x[0] = "ok"

2. Second case:

x = t
x[0] = "ok"

3. Given the tuple:

tup = (0, 1, 2, [3, 4, 5], 6, 7, 8)

1. What is the type of the first element of the tuple?
2. What is the type of the fourth element?
3. How many elements does the tuple contain?
4. How many elements does the inner list contain?
5. Change the last element of the inner list to "last element".
6. Change the last element of the tuple to "very last element". (Can you do that without resorting to tricks?)