← Back to challenges

Injection IV.E: Inside the Class

PythonHardclassesdata_structuresgameslogic

Instructions

The bookstore from this collection is adamant in using eval(), but has moved the users dictionary into a class to prevent copying. The check_a_user(name) function returns entries in users which match a given username. Create a query that copies users to res.

Examples

res = eval("check_a_user({})".format(user_name),
           {'check_a_user': check_a_user})

print(res) ➞ clients.all_users(control_num)

Notes

Create a string, not a function.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.