+ 3
I want an explain to this labeling code
You are building a search system and need to search for the character 'a' in an input string. Output "Match" if 'a' is found in the string, and "No match" if it's not. Sample Input great Sample Output Match When i run it only the "No match" was work and the "Match" was not work Can anyone tell me why and if he can write the right that will be awesome :) My code -》 s = input() #your code goes here items=['A','a'] if items in s : print("Match") else : print("No match")
4 Respuestas
+ 7
It says to check for "a" only so I don't get why are you checking for "A" as well?
And also the line "if items in s" is equivalent to searching a list (["A","a"] ) in the input ,is that what you need to find here?
According to question it should be simply as following:
if "a" in s:
print("Match")
else:
print("No match")
+ 3
thank you my problem was solved
+ 1
s = input()
if 'a' in s:
print('Match')
else:
print('No match')
😊👍
0
123