You've been collecting change all day, and it's starting to pile up in your pocket, but you're too lazy to see how much you've found.

Good thing you can code!

Create ```change_count()``` to return a dollar amount of how much change you have!

Valid types of change include:
```
penny: 0.01
nickel: 0.05
dime: 0.10
quarter: 0.25
dollar: 1.00
```

```if:python
These amounts are already preloaded as floats into the `CHANGE` dictionary for you to use!
```
```if:ruby
These amounts are already preloaded as floats into the `CHANGE` hash for you to use!
```
```if:javascript
These amounts are already preloaded as floats into the `CHANGE` object for you to use!
```
```if:php
These amounts are already preloaded as floats into the `CHANGE` (a constant) associative array for you to use!
```

You should return the total in the format ```$x.xx```.

Examples:

```python
change_count('nickel penny dime dollar') == '$1.16'
change_count('dollar dollar quarter dime dime') == '$2.45'
change_count('penny') == '$0.01'
change_count('dime') == '$0.10'
```

Warning, some change may amount to over ```$10.00```!

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def change_count(change):
	

Solutions:
def change_count(change):
	money = {'penny': 0.01, 'nickel': 0.05, 'dime': 0.1, 'quarter': 0.25, 'dollar': 1.0}
	count = 0
	for coin in change.split():
		count += money[coin]
	result = '%.2f' % count
	return '$' + result


def change_count(change):
	total = 0
	for i in change.split(' '):
		if i == 'penny':
			total += 0.01
		elif i == 'nickel':
			total += 0.05
		elif i == 'dime':
			total += 0.1
		elif i == 'quarter':
			total += 0.25
		elif i == 'dollar':
			total += 1.0
	return '${:.2f}'.format(total)
print(change_count('dime penny dollar'))
print(change_count('dime penny nickel'))
print(change_count('quarter quarter'))
print(change_count('dollar penny dollar'))


CHANGE = {'penny': 1, 'nickel': 5, 'dime': 10, 'quarter': 25, 'dollar': 100}

def change_count(change):
	return '${}.{:0>2}'.format(*divmod(sum((CHANGE[a] for a in change.split())), 100))


def change_count(change):
	a = change.split(' ')
	L = []
	for i in range(len(a)):
		if a[i] == 'penny':
			L.append(0.01)
		elif a[i] == 'nickel':
			L.append(0.05)
		elif a[i] == 'dime':
			L.append(0.1)
		elif a[i] == 'quarter':
			L.append(0.25)
		elif a[i] == 'dollar':
			L.append(1.0)
	b = sum(L)
	x = round(b + 1e-07, 2)
	a = '$' + '%.2f' % x
	y = a.split()
	if len(y) == 4:
		y.append('0')
		return sum(y)
	else:
		return a


def change_count(ch):
	total = float(0.0)
	ch = ch.split()
	for x in ch:
		if 'dollar' in x:
			total += 1.0
		if 'quarter' in x:
			total += 0.25
		if 'dime' in x:
			total += 0.1
		if 'nickel' in x:
			total += 0.05
		if 'penny' in x:
			total += 0.01
	return '${:.2f}'.format(total)