Formatters Flashcards

1
Q

%r

A

Used for debugging, it displays the “raw” data of the variable

Ex:
print “Man, this guy has %r watermelons! That’s a %r of watermelons.” % (23, lot)

Man, this guy has ‘23’ watermelons! That’s a ‘lot’ of watermelons.

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

%s

A

Used for displaying strings

Ex:
print “Hello, %s!” % World

Hello, World!

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

%d

A

Used for displaying numbers

Ex:
print “Hello, I am %d years old.” % 23

Hello, I am 23 years old.

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