Ask coding questions

← Back to all posts
( Economy data - Replit DB?
meziosaur (0)

I needed some guidance, I wanted to save 4 kinds of currencies per user into a replitDB.

I'm kinda lost and not sure where to start with it.
Would I need a key per user like so:

It's this the right train of thought?

OldWizard209 (1702)

You will need to save a dictionary as a value to the username's key"

Coder100 (19277)

How about this:

remember to treat it like a dict.

OldWizard209 (1702)

Are you sure you can access a value in a dictionary in Python using a dot notation? You are using the concept of JavaScript Objects in this example:


Coder100 (19277)

well it was a semantic example after all @OldWizard209

Coder100 (19277)

but from what i can tell id is a property of the class user @OldWizard209

OldWizard209 (1702)

Well if it is a property then you were right but as a general example, it should be best to do db[user][id]. Also, the user(question asker) said they were using multiple currencies so it would be better to save a dictionary as a value in the db, containing all the currencies.

Coder100 (19277)

yes that is what i did did you not see @OldWizard209