Ask your own question, for FREE!
Computer Science 24 Online
kekeman:

OMG HELPPPPPPPPPPPPPPP: A program requires the password "PASS." This password is case sensitive, but you want users who enter "pass" to still gain access. What code can be used to validate user input, u_pass, against the actual password, PASS? u_pass == "PASS" u_pass == "PASS".upper() u_pass is "PASS" u_pass.upper() == "PASS"

Sherixn:

It's case sensitive but people who enter the lower case "pass" still gain access?

Sherixn:

That doesn't make much sense

Spectrum:

exact

Extrinix:

It's trying to get you to input a certain line of code to get it to be exactly PASS, not pass, or PaSs, or any of those.

Sherixn:

Oohhh that makes more sense

Ultrilliam:

@extrinix wrote:
It's trying to get you to input a certain line of code to get it to be exactly PASS, not pass, or PaSs, or any of those.
That's what I would think, but it's also saying "pass" should still work, which would make it case insensitive, the question is contradicting itself

kekeman:

Yea I was thinking u_pass is "PASS" or u_pass == "PASS"

Sherixn:

I know the answer but I cant think of a good way to explain it

Extrinix:

@kekeman wrote:
Yea I was thinking u_pass is "PASS" or u_pass == "PASS"
u_pass is "PASS" is not a function of basically any coding language, unless maybe code blocks, but those sometimes aren't that either

kekeman:

Hmmmm okayy

Extrinix:

You couldn't use u_pass.upper() == "PASS" because the ".upper()" is an identifier of a specific type, BUT, in this case would be used as a variable and/or constant

Extrinix:

@extrinix wrote:
You couldn't use u_pass.upper() == "PASS" because the ".upper()" is an identifier of a specific type, BUT, in this case would be used as a variable and/or constant
I should say a part of the variable/constant

Ultrilliam:

@extrinix wrote:
You couldn't use u_pass.upper() == "PASS" because the ".upper()" is an identifier of a specific type, BUT, in this case would be used as a variable and/or constant
I disagree with this, I feel like the question is asking that u_pass always evaluate to "PASS". .upper() would bring it to uppercase to match against == "PASS" - the question asks for both "PASS" and "pass" to be correct. So my assumption is that the case sensitive portion is a typo, else all of the answers are technically incorrect.

kekeman:

Oof this question is confusing

Extrinix:

@ultrilliam wrote:
extrinix wrote:
You couldn't use u_pass.upper() == "PASS" because the ".upper()" is an identifier of a specific type, BUT, in this case would be used as a variable and/or constant
I disagree with this, I feel like the question is asking that u_pass always evaluate to "PASS". .upper() would bring it to uppercase to match against == "PASS" - the question asks for both "PASS" and "pass" to be correct. So my assumption is that the case sensitive portion is a typo, else all of the answers are technically incorrect.
But the u_pass variable hasn't been defined yet?

Extrinix:

I mean, I understand your pov

Ultrilliam:

@extrinix wrote:
@ultrilliam wrote:
extrinix wrote:
You couldn't use u_pass.upper() == "PASS" because the ".upper()" is an identifier of a specific type, BUT, in this case would be used as a variable and/or constant
I disagree with this, I feel like the question is asking that u_pass always evaluate to "PASS". .upper() would bring it to uppercase to match against == "PASS" - the question asks for both "PASS" and "pass" to be correct. So my assumption is that the case sensitive portion is a typo, else all of the answers are technically incorrect.
But the u_pass variable hasn't been defined yet?
In this case the question is defining it as a string that the user inputs, so since we are dealing with the python programming language (despite it not being clear here), .upper() is a function to bring the string to uppercase in python

Extrinix:

@ultrilliam wrote:
extrinix wrote:
@ultrilliam wrote:
extrinix wrote:
You couldn't use u_pass.upper() == "PASS" because the ".upper()" is an identifier of a specific type, BUT, in this case would be used as a variable and/or constant
I disagree with this, I feel like the question is asking that u_pass always evaluate to "PASS". .upper() would bring it to uppercase to match against == "PASS" - the question asks for both "PASS" and "pass" to be correct. So my assumption is that the case sensitive portion is a typo, else all of the answers are technically incorrect.
But the u_pass variable hasn't been defined yet?
In this case the question is defining it as a string that the user inputs, so since we are dealing with the python programming language (despite it not being clear here), .upper() is a function to bring the string to uppercase in python
Okayyyyy that would make more since, knowing the language would've helped there

Sherixn:

why don't you guys just run and complie a test in an IDE :P

Sherixn:

And solve this argument

kekeman:

So what two options are we looking at for a possible answer

Extrinix:

@sherixn wrote:
why don't you guys just run and complie a test in an IDE :P
Running it in an IDE without the rest of the code wouldn't even work.

kekeman:

Yea there is no code but if there was code I would just plug in every option to see the outcome

Ultrilliam:

@sherixn wrote:
And solve this argument
There isn't much of an argument here, all the options are technically wrong on this question with what the question is asking. So my only guess is that it actually meant to say case insensitive, in which case you would match the users input to uppercase to match the value of the check which is "PASS" to make it case insensitive. Knowing that, what would be the answer? @kekeman

kekeman:

u_pass.upper() == "PASS"

Ultrilliam:

Correct

Extrinix:

kekeman wrote:
u_pass.upper() == "PASS"
@ultrilliam wrote:
Correct
Now I understand what you were saying about this, the .upper() identifies the opposite of PASS, but doesn't eliminate the option of PASS, so thanks for making me understand the question xd

kekeman:

Thank you both :)

Extrinix:

I tried, the question was worded very badly

Sherixn:

@extrinix wrote:
@sherixn wrote:
why don't you guys just run and complie a test in an IDE :P
Running it in an IDE without the rest of the code wouldn't even work.
You could create a variable u_pass and run it through, setting it to "pass" and then "PASS"

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!