formatting Flashcards

1
Q

str.format()

A

optional method that gives users more control over output

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

use formatting to print a statement reading “Jack loves Dogs”

use the variables below and positional arguments
Name = “Jack”
Animal = “Dogs”

A

Name = “Jack”
Animal = “Dogs”
print(“{0} loves {1}”).format(Name,Animal)

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

use formatting to print a statement reading “Jack loves Dogs”

use the variables below and keyword arguments arguments
Name = “Jack”
Animal = “Dogs”

A

print(“{Name} loves {Animal}”).format(Name=”Jack”,Animal=”Dogs”)

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

Using formatting to display a number to a sf

A

(int) is how many sf

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