String Formats Flashcards

1
Q

%d

A

decimal integers (not floating point)

“%d” % 45 == ‘45’

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

%i

A

same as %d

“%i” % 45 == ‘45’

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

%o

A

octal number

“%d” % 1000 == ‘1750’

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

%u

A

unsigned decimal

“%u” % -1000 == ‘1000’

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

%x

A

hexadecimal lowercase

“%x” % 1000 == ‘3e8’

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

%x

A

hexadecimal uppercase

“%X” % 1000 == ‘3E8’

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

%e

A

exponential notation, lowercase ‘e’

“%e” % 1000 == ‘1.000000e+03’

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

%E

A

exponential notation, uppercase ‘E’

“%E” % 1000 == ‘1.000000E+03’

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

%f

A

floating point real number

“%f” % 10.34 == ‘10.34’

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

%F

A

same as %f

“%F” % 10.34 == ‘10.34’

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

%g

A

same as %f or %g

“%g” % 10.34 == ‘10.34’

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

%c

A

character format

“%c” % 34 == ‘ “ ‘

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

%r

A

repr format (debugging format)

“%r” % int == “”

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

%s

A

string format

“%s there” % hi == ‘hi there’

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

%%

A

a percent sign

“%g%%” % 10.34 == ‘10.34%’

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