Im creating a simple python program that gives basic functionality of an SMS_Inbox. I have created an SMS_Inbox method.
store = []
message_count = 0
class sms_store:
def add_new_arrival(self,number,time,text):
store.append(("From: "+number, "Recieved: "+time,"Msg: "+text))
**message_count += 1**
def delete(self,i):
if i > len(store-1):
print("Index does not exist")
else:
del store[i]
message_count -= 1
In the bolded bit I am getting an error:
UnboundLocalError: local variable 'message_count' referenced before assignment.
I created a global variable store which is an empty list and this works when I use the add_new_variable object. However for some reason it is not adding values to my global message_count variable.
Please help
count...message_count?message_count, when you can just dolen(store)?