Strings Flashcards

1
Q

Object

A

A data type that combines state(data) and behaviour(code)

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

String

A

Sequences of characters

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

Unicode

A

International encoding standard for use with different languages and scripts by which each letter, digit or symbol is represented by a numeric value

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

ord(“a”)

A

Return unicode number for 1-character string(97)

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

chr(97)

A

returns the 1-character string with unicode symbol

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

int(“1234”)

A

Returns integer value

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

str(1234)

A

returns the string value

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

Print 2 variables in order

A

“{0} {1}.format” (“one”, “two”)

‘one two’

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

Reverse order

A

“{1} {0}”.format(“one”, “two”)

‘two one’

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

align fixed width

A

“{0:<20}”. format - left
“{0:>20}”.format - right
“{0:^20}”.format - centre

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

Floating point number rounding

A

“{0:5.3f}”.format(1.23456789)

‘1.235’

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

s.count(search)

A

returns integer number of search strings found within s

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

s.find(search)

A

returns position of first search string found within s

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

s.lower/upper()

A

return lowercase/uppercase version of s

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

s.replace(old, new)

A

Returns version of s with every occurrence of old replaced with new

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