S=“Hello”不正确的是?

S=“Hello”不正确的是? A:" " in s 是 True B:"ll" not in s 是 False C:"L" not in s 是 False D:"l" in s 是 True 选什么?愁死了

这道题选:D,in在python中表示是否在的意思,判断字符串是否在某个字符串中,在返回true,不在返回false.

就是判断字符在不在S里,

A是空格在S里,S里没有空格,所以是False,A中说是true,所以是错误的。

B是ll在S里,应该返回Ture,B中说是False,所以也是错误的。

C是L不再S理,应该是True,C中说是False,所以也是错误的。

D是l在S里,应该是True,跟D中答案一致,所以选D

 

你确定楼上不是瞎说吗?C这么明显的错误。“L” not in s这句话的结果是True,因为大写的L不在s里面的,所以这题选C。如果你的A选项中间有个空格的话,这题就选AC,如果没有空格,就选C

s="Hello"
print("A:"+str(("" in s )))
print("B:"+str(("ll" not in s )))
print("C:"+str(("L" not in s )))
print("D:"+str(("l" in s )))

#output

A:True
B:False
C:True
D:True