Correct text is:
A. str(1-1) in '0123456789'
B. 'dcb' not in 'abcde'[::-1]
C. 'phd' in 'alpha'
D. 'True' not in 'False'
A. str(1-1) in ‘0123456789’ evaluates to True because str(1-1) is ‘0’ which is in ‘0123456789’.
B. ‘dcb’ not in ‘abcde’[::-1] evaluates to False because ‘dcb’ is in the reversed string ‘edcba’.
C. ‘phd’ in ‘alpha’ evaluates to False because there is no substring ‘phd’ in the string ‘alpha’.
D. ‘True’ not in ‘False’ evaluates to True because the string ‘True’ is not a substring of the string ‘False’.
There is something wrong with the choices
print (str(1-1) in '123456789'[:2])
print ('dcb' not in 'abcde'[::-1])
print ('phd' in 'aplpha')
print ('True' not in 'False')
False
False
False
True
Did the options change from:
A. str(1-1) in '123456789'[:2]
'0' in '12' is False
B. 'dcb' not in 'abcde'[::-1]
'dcv not in 'edcba' is False
C. 'phd' in 'aplpha'
definitely False
D. 'True' not in 'False'
Only D is True
str(1-1) in [2:]"123456789"
File "<stdin>", line 1
str(1-1) in [2:]"123456789"
^
SyntaxError: invalid syntax
>>> 'dcb' not in 'abcde[1-::]'
True
>>> 'phd' in 'aplpha'
False
>>> 'True' not in 'False'
True
So its BD
before providing any answer, please place the code into any IDE. In Pycharm:
print("dcb" not in "abcde"[::-1]) returns False. To clarify, in the expression "dcb" not in "abcde"[::-1], the substring 'dcb' is indeed present in the reversed string 'edcba'. Therefore, the correct evaluation is False, not True.
It also comes down to what is supposed to be the correct text. I have come across this question elsewhere with the below answers which would mean A & D were correct.
A. str(1-1) in '0123456789'
B. 'dcb' not in 'abcde'[::-1]
C. 'phd' in 'alpha'
D. 'True' not in 'False'
upvoted 5 times
...
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
aferiver
Highly Voted 1 year, 7 months agoswatiphadtare
1 year, 6 months agoJnanada
Highly Voted 2 years, 3 months agoDamon54
Most Recent 9 months, 3 weeks agoDamon54
9 months, 3 weeks agozantrz
9 months, 4 weeks agostuartz
2 years, 5 months agostuartz
2 years, 5 months agocarpmatias
2 years, 6 months agomacxsz
2 years, 6 months agorocky48
2 years, 8 months agozantrz
9 months, 4 weeks agoNoarmy315
2 years, 11 months agomazimir
3 years, 1 month agotechdawgs
2 years, 11 months ago