Access deny problem | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 2

Access deny problem

https://sololearn.com/compiler-playground/cB926gxh4s70/?ref=app When I type username and password with a space in the end it causing Access Deny can't we make it flexible? So that the interpreter ignores the spaces

19th May 2024, 4:39 AM
FREEZO
FREEZO - avatar
3 Respuestas
+ 5
FREEZO a simple solution could be as if username == "apple" or username == "apple " and password == "knife" or password == "knife ": In the above example there is the correct value or value with a whitespace another option is using .rstrip() username = username.rstrip() password = password.rstrip() .rstrip(): Removes trailing characters (whitespace by default) from the right side of the string.
19th May 2024, 4:47 AM
BroFar
BroFar - avatar
+ 4
BroFar thank you it works! :)
19th May 2024, 4:52 AM
FREEZO
FREEZO - avatar
+ 4
You're welcome
19th May 2024, 5:00 AM
BroFar
BroFar - avatar