+ 2

Please correct my 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 --------MY CODE------ search = input() #your code goes here alpha = "a" if "a" in search == "a" in alpha: print("Match") else: print("No match")

22nd Jan 2021, 12:10 PM
Valentine Madzore
Valentine Madzore - avatar
9 Answers
22nd Jan 2021, 12:21 PM
noteve
noteve - avatar
+ 6
if alpha in search: # or if "a" in search:
22nd Jan 2021, 12:14 PM
noteve
noteve - avatar
+ 6
Sir Valentine Madzore in the line 4 of you code why have you written, == "a" in alpha. It is extra you should remove it, I think that is the reason why your code is showing error. ( if "a" in search ) is enough
22nd Jan 2021, 1:23 PM
โˆ†BHโˆ†Y
โˆ†BHโˆ†Y - avatar
+ 2
It's still bringing back no match on asd
22nd Jan 2021, 12:18 PM
Valentine Madzore
Valentine Madzore - avatar
+ 2
Thank you guys
22nd Jan 2021, 2:41 PM
Valentine Madzore
Valentine Madzore - avatar
+ 1
Thanks ๐Ÿ‘
22nd Jan 2021, 6:19 PM
Valentine Madzore
Valentine Madzore - avatar
+ 1
๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ‘
24th Jan 2021, 8:01 AM
Vrajesh Sulakhe
Vrajesh Sulakhe - avatar
+ 1
s = input() if "a" in s: print("Match") else: print("No match")
14th Nov 2021, 4:29 PM
Aman Verma
Aman Verma - avatar
0
search = input() alpha = "a" if alpha in search: print("Match") else: print("No match")
24th Jan 2021, 7:29 AM
Akhlaque Ahmad
Akhlaque Ahmad - avatar