Why does the following code give the following error and how do i assign it to blank dictionary within the function:

```
import time 

dictionary_power_readings = {}

def update_dict():
    ApparentPower = "power"
    dictionary_power_readings[time.time()] = ApparentPower
    print(dictionary_power_readings)
    dictionary_power_readings ={} 

while True:
    update_dict()
    time.sleep(1)

```

> 
> Traceback (most recent call last): File
> "updating\_dict\_from\_function.py", line 15, in 
> update\_dict() File "updating\_dict\_from\_function.py", line 7, in update\_dict
> dictionary\_power\_readings[time.time()] = ApparentPower UnboundLocalError: local variable 'dictionary\_power\_readings'
> referenced before assignment
> 
> 
>