Assignment 3: Built-in Objects
Python contains a number of built-in types. These include numbers,
strings, lists, dictionaries, and tuples
Experiment with these types, interactively and in files. Try
calculating some basic arithmetic.
Make a string with your name and address in it and try and print out different
parts of it, eg you first name, street number, or post code. What happens when you
try to change part of it?
What is the difference between indexing and slicing, and how do they work?
Make a dictionary of movies characters and the actors, and work out how to ask who
plays a certain role, or what part an actor plays.
Try doing the same thing with tuples. Are there any differences in the way they work.
Have you found any limitations to these types, what can't they do. How do they differ.
Write a data structure to contain your personal details, you may use any combinations
of the above data types. You need to be able to print or change anything that may need
changing in a real life situation. Explain the rational behind your choices.
Note.This is not an exercise in disclosing personal details, nor a quiz on
your movie knowledge. Feel free to use fictitious data, or substitute some other type
of information to what I have suggested.
Click here to send your answer.