- Q2 Write A Python Program That Uses Processes To Edits A Global Variable Your Program Should Have 8 Marks The Glo 1 (78.76 KiB) Viewed 18 times
Q2) Write a python program that uses processes to edits a global variable. Your program should have: (8 Marks) • The glo
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Q2) Write a python program that uses processes to edits a global variable. Your program should have: (8 Marks) • The glo
Q2) Write a python program that uses processes to edits a global variable. Your program should have: (8 Marks) • The global variable: "account_balance" • The function "deposit_balance(amount)" which takes "amount" as a float parameter, and adds it to the global variable "account_balance". The function "withdraw_balance(amount)" which takes "amount" as a float parameter, and withdraws it from the global variable "account_balance". • Two processes that invoke the two functions above. Note that "amount" should be entered by the user and passed to the processes. • Make sure that the data is consistent (Use a proper lock on the variable).