Just Python Things Flashcards

(9 cards)

1
Q

strip()

A

removes the leading and the trailing whitespaces
eg
some_string.strip()

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

line = “ the woman has the sword of world the”

print(line.strip(“ the”))

A

woman_has_the_sword_of_world

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

ord(“Z”)

A

90

the ASCII value

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

some_variable = some_string.split(“,”)

A

splits some_string into different parts and returns list

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

sorted(some_list)

A

sorts the some_list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
def print_first_word(words):
    word = words.pop(0)
    print(word)
A

Prints the first word after popping it off

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
def print_first_word(words):
    word = words.pop(-1)
    print(word)
A

Prints the last word after popping it off

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
def brake_words(stuff):
    """What's this?"""#What's the use of this line
    words=stuff.split(' ')
    return words
A
#after importing the file.py and typing
help(file.brake_words)
#prints What's this its like the discription of the function
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
def brake_words(stuff):
    """What's this?"""#What's the use of this line
    words=stuff.split(' ')
    return words
A
#after importing the file.py and typing
help(file.brake_words)
#prints What's this its like the discription of the function
How well did you know this?
1
Not at all
2
3
4
5
Perfectly