Web Analytics

1) Given the following Python code, what will the data type of pet be?

pet = "Gordon", "Gecko", 3


2-4 answers should either be TRUE or FALSE.


2) The following statement can cause an exception: names_file = open('names.txt', 'r')


3) A file object's writelines method automatically writes a newline (' ') after writing each list item to the file.


4) The else suite in a try/except statement executes only if a statement in the try suite raises an exception.

Verified Answer :

Here are the answers:
1) The data type of pet is composite date type.

2) The following statement can cause an exception: names_file = open('names.txt', 'r') is False

3) A file object's writelines method automatically writes a newline (' ') after writing each list item to the file is True

4) The else suite in a try/except statement executes only if a statement in the try suite raises an exception is Flase