var myDB = new Array();
myDB = "";
myDB = "another entry";
The reason I like this, and why I am having troubles is that I am trying to replicate this in python. The reason I want to replicate this in python is because I am working on a psuedo operating system, and would like to allow users to add new entries to the variable that don’t yet exist. If I could make it work, this is what it would look like:
myDB = #Array
userAdd = input('what would you like to add to the array?')
myDB[myDB.length + 1] = userAdd
I hope this makes sense.
To be a little more clear – I am wanting this to act as a sort of session memory. The only way I can realistically think to make things work currently is to limit users to the amount of memory spaces I create as as many variables allocated to it, such as follows:
myDB0 = ''
myDB1 = ''
myDB2 = ''
myDB3 = ''
myDB4 = ''
editDB = input('what slot would you like to change?')
if editDB == '1':
addMem = input('what would you like it to be?')
myDB0 = addMem
#And et cetera for each memory space
Of course, this is not good python. Just use my_db.append(...) instead of my_db[i] = ...
my_db = 
user_add = input('what would you like to add to the array?')
index = int(input('what slot would you like to change'))
if 0 <= index < len(my_db):
item = input('what would you like it to be?')
my_db[index] = item
print('slot does not exist')