Question: I am currently doing the US Medical Insurance Cost Portfolio Project through Code Academy and am having trouble combining two lists into a single dictionary. I created two new lists (`smoking_status` and `insurance_costs`) in hope of investigating how insurance costs differ between smokers and non-smokers. When I try to zip these two lists together, however, the new dictionary only has two components. It should have well over a thousand. Where did I go wrong? Below is my code and output. It is worth nothing that the output seen is the last two data points in my original csv file.

```
import csv

insurance_db = 

with open('insurance.csv',newline='') as insurance_csv:
    insurance_reader = csv.DictReader(insurance_csv)
    for row in insurance_reader:
        insurance_db.append(row)

smoking_status = []

for person in insurance_db:
    smoking_status.append(person.get('smoker'))

insurance_costs = []

for person in insurance_db:
    insurance_costs.append(person.get('charges'))

smoker_dictionary = {key:value for key,value in zip(smoking_status,insurance_costs)}

print(smoker_dictionary)

```

Output:

```none
{'yes': '29141.3603', 'no': '2007.945'}

```

Answer: 
> 
> Is there a way to update Progressbar from another thread
> 
> 
> 

Short answer: No. A control can only be updated on the thread on which it was originally created.

What you can do is to display the `ProgressBar` in another window that runs on another thread and then close this window when the `RichTextBox` on the original thread has been updated.
Create a method on your form to update the element you want to update and use invoke to run it from your thread

like that:

```
   private void Form1_Load(object sender, EventArgs e)
        {
            Thread _thread = new Thread(() =>
            {
                //do some work
                upDateUiElements();//pass any parameters you want
            });
            _thread.Start();
        }

        public  void upDateUiElements()//input any parameters you need
        {
                BeginInvoke(new MethodInvoker(() =>
                {            
                //update ui elements
                }));           
        }

```

If you need to invoke it from a different class you can pass your form as an object and then access the method through that object

Like that:

```
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            OtherClass _class = new OtherClass(this);
            _class.runthread();
        }

        public  void upDateUiElements()//input any parameters you need
        {
            BeginInvoke(new MethodInvoker(() =>
            {
                //update ui elements
            }));
        }
    }

    class OtherClass
    {
        private Form1 _accessForm1;

        public OtherClass(Form1 accessform1)
        {
            _accessForm1 = accessform1;
        }

        public void runthread()
        {
            Thread _thread = new Thread(() =>
            {
                //do some work
                _accessForm1.upDateUiElements();
            });
            _thread.Start();
        }
    }

```