ADV PROG DAY 5 Flashcards

1
Q

Generates a list of every number between 0 and up to, but not including, the value specified by Stop. Start is defaulted to a value of 0 and step is defaulted to a value of 1.

A

range( Stop )

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

Generates a list of every number between the value specified by Start Generates a list of every number between the value specified by Start and up to, but not including, the value specified by Stop. Step is defaulted to a value of 1.and up to, but not including, the value specified by Stop. Step is defaulted to a value of 1.

A

range( Start, Stop )

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

Generates a list of every number between the value specified by Start and up to, but not including, the value specified by Stop, incrementing by the value specified by Step. (Step can be a negative value)

A

range( Start, Stop, Step )

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

Informs Python that the following block of code is a function definition.

A

def

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

A unique name by which a function is known. Following the same rules as variable naming (i.e., can contain letters, numbers, and underscores only, but may not begin with a number).

A

function_name

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

Functions can be written to allow from zero to 255 arguments. If a parameter contains an equal sign, the right-side is the default value in case no argument was passed. Each parameter must have a unique name.

A

parameters

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

The code to execute when the function is called.

A

function_body

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

Optional. Returns a value from the function to where it was called. A function without a return instruction automatically returns after all logically sequential instructions have been executed.

A

return

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

s a file that contains one or more functions and/or classes that may be reused to save time writing and debugging new source code.

A

module

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

Make the . (match any character), include

A

re.S

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

Allow case insensitive searches on string

A

re.I

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

Allows the expression to search for strings which span multiple lines

A

re.M

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

looks through the entire string for the pattern specified.

A

search()

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

which isolates just that segment of the string.

A

group()

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

returns a list of matches to all non-overlapping values in a specified string. This is useful when there may be more than one instance of data to extract.

A

findall()

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

occurs when a resource or event causes a major error within a program.

A

exception

17
Q

A block of code defined as the body of a TRY statement executes. If an exception occurs in the program, the EXCEPT portion of the statement immediately executes,allowing the programmer to handle the error before the OS or Interpreter. This has the effect of ignoring any remaining code in the try block, and mitigating the crash proactively.

A

try-except

18
Q

An illegal arithmetic operation, such as division by zero or a math result too large for the containing data type, has occurred

A

ArithmeticError

19
Q

When an input or output operation fails; opening a file that does not exist or when network socket operations fail.

A

IOError

20
Q

The subscripted index specified is out of range.

A

IndexError

21
Q

An operation applied to an object of an inappropriate type.

A

TypeError

22
Q

An operation or function received the correct data type, but the value given was inappropriate; trying to convert a string to a number. If the string contains anything other than numbers, this exception is raised.

A

ValueError

23
Q

allows a program to send/receive data across a network. Similar to how a file handle provides access to a hard drive, a socket provides direct access to a network card.

A

socket

24
Q

Creates socket object used for endpoint communication.

A

.socket()

25
Q

Returns a string containing the local computer name.

A

.gethostname()

26
Q

Attempts to bind the socket to a physical interface.

A

.bind()

27
Q

Listen for incoming connections.

A

.listen()

28
Q

Initiates connection from the client.

A

.connect()

29
Q

Accepts an incoming connection, returns a tuple containing a connection object and source address/port of the client.

A

.accept()

30
Q

Closes the socket.

A

.close()

31
Q

Specifies optional hardware/socket configuration.

A

.setsockopt()

32
Q

Reads string data from the socket, returns nothing if client closed the connection. N specifies number of bytes to read at one time, required.

A

.recv(N)

33
Q

Sends string data to the client.

A

.send(s)

34
Q

Closes the connection.

A

.close()

35
Q

replies to a client with the same message it received and is typically used to allow the client and server to successfully communicate.

A

echo server