Question: using python 2. Write a program that has the account balance as a global variable and the function add_balance(amount). The function reads the current balance

 using python 2. Write a program that has the "account balance"

using python

2. Write a program that has the "account balance" as a global variable and the function "add_balance(amount)". The function reads the current balance value, adds an amount to it (which is entered by the user) and writes the new value to the balance variable. After that, create 2 threads which will invoke the add_balance(amount) function and add different values. Run the program and make sure that the data is consistent (Use a proper lock on the variable)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!