Ask coding questions

← Back to all posts
What should the code be in file main.py function login
AyushGudipati (11)

So, I was creating a part 2 for the Orbitron game (https://orbitron-3.leviathancoding.repl.co/) which includes a login function. But I wasn't sure what to put for the login function starting from line 18. This is using py, html, css, and some js.

Any suggestions?

Comments
hotnewtop
Coder100 (18911)

you should use replit db for much easier storage and much better and safer storage for your users. Otherwise, what you have done is correct.

AyushGudipati (11)

@Coder100 Thx a lot, but when debugging the login function, I was given a typerror.

Coder100 (18911)

@AyushGudipati yeah you are storing it inside an array, so you either have to loop through the array (inefficient) or actually store it as a dict, like:

db['username'] = { 'password': '...' }
AyushGudipati (11)

@Coder100 oh ok. thx a lot. should get it working soon.

AyushGudipati (11)

@Coder100 I still get an error though. typerror.

AyushGudipati (11)

@Coder100 IDK how to use replit db FYI.

JakeHu2020 (33)

If you ping/share-with me I can help