192k views
1 vote
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.

User LoneDuck
by
8.4k points

1 Answer

7 votes
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
User Kam Sen
by
8.8k points