Bullet Points Flashcards

1
Q

What do you use the open() BIF for?

A

Use the open() BIF to open a disk file, creating an iterator that reads data from the file one line at a time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does the readline() method do?

A

The readline() method reads a single line from an opened file?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the seek() method used for?

A

The seek() method can be used to “rewind” a file to the beginning

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does the close() method do?

A

The close() method closes a previously opened file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does the split() method do?

A

The split() method can break a string into a list of parts

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What do we call an unchangeable, constant list in Python?

A

An unchangeable, constant list in Python is called a tuple.

Once the list is assigned to a tuple, it cannot be changed. Tuples are immutable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Under what conditions does a ValueError occur?

A

A ValueError occurs when your data does not conform to an expected format

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Under what conditions does an IOError occur?

A

An IOError occurs when your data cannot be accessed properly

e.g., perhaps your data file has been moved or renamed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does the help() BIF do?

A

The help() BIF provides access to Python’s documentation within the IDLE shell

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does the find() method do?

A

The find() method locates a specific substring within another string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does the ‘not’ condition do?

A

The ‘not’ keyword negates a condition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What function or mechanism does the try/except statement provide?

A

The try/except statement provides an exception-handling mechanism, allowing you to protect lines of code that might result in a runtime error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does the ‘pass’ statement represent in Python?

A

The ‘pass’ statement is Python’s empty or null statement; it does nothing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly