In [1]:

```
def main():
quarters = int(input("Quarters: " ))
dimes = int(input("Dimes: " ))
nickels = int(input("Nickles: " ))
pennies = int(input("Pennies: " ))
total = quarters*0.25 + dimes*0.10 + nickels*0.05 + pennies*0.01
print("The total value of your change is", total)
```

In [2]:

```
main()
```

Quarters: 6 Dimes: 0 Nickles: 0 Pennies: 0 The total value of your change is 1.5

In [3]:

```
def main():
quarters = int(input("Quarters: " ))
dimes = int(input("Dimes: " ))
nickels = int(input("Nickles: " ))
pennies = int(input("Pennies: " ))
total = quarters*0.25 + dimes*0.10 + nickels*0.05 + pennies*0.01
formatted = "\nThe total value of your change is ${0:0.2f}".format(total)
print(formatted)
```

In [4]:

```
main()
```

Quarters: 6 Dimes: 0 Nickles: 0 Pennies: 0 The total value of your change is $1.50

In [5]:

```
def main():
quarters = int(input("Quarters: " ))
dimes = int(input("Dimes: " ))
nickels = int(input("Nickels: " ))
pennies = int(input("Pennies: " ))
total = quarters*0.25 + dimes*0.10 + nickels*0.05 + pennies*0.01
template = "\nThe total value of your change is ${0:0.2f}"
print(template.format(total))
```

In [6]:

```
main()
```

Quarters: 6 Dimes: 0 Nickles: 0 Pennies: 0 The total value of your change is $1.50

`int`

values¶In [20]:

```
def main():
quarters = int(input("Quarters: " ))
dimes = int(input("Dimes: " ))
nickels = int(input("Nickles: " ))
pennies = int(input("Pennies: " ))
total = quarters*25 + dimes*10 + nickels*5 + pennies
#formatted = "\nThe total value of your change is ${0}.{1:0>2}".format(total//100, total%100)
formatted = f"\nThe total value of your change is ${total//100}.{total%100:0>2}"
print(formatted)
```

In [21]:

```
main()
```

Quarters: 6 Dimes: 0 Nickles: 0 Pennies: 0 The total value of your change is $1.50

In [22]:

```
from math import pi
```

In [23]:

```
"This float, {0:10.5}, has a width 10 and a precision 5".format(pi)
```

Out[23]:

'This float, 3.1416, has a width 10 and a precision 5'

In [24]:

```
"This float, {0:10.5f}, has a width 10 and a precision 5".format(pi)
```

Out[24]:

'This float, 3.14159, has a width 10 and a precision 5'

In [25]:

```
"This float, {0:10.5g}, has a width 10 and a precision 5".format(pi)
```

Out[25]:

'This float, 3.1416, has a width 10 and a precision 5'