0
My Python code does not go through Test Cases
The given question is: 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. My code: s = input() b = print (a in s) if b True print ("Match") else print ("No Match") You can find the task at the Python course under List operators and then you go to the challenge Build a search Engine
7 Antworten
+ 1
Your code will work after some changes. Compare with your code.
s = input()
b = 'a' in s
if b == True:
print ("Match")
else:
print ("No Match")
but you can also in one line:
print('Match' if 'a' in input() else 'No Match')
+ 9
Thursday You're looking for something like this?
https://code.sololearn.com/crafynW295I3/?ref=app
+ 1
Yes Thanks
+ 1
Noshin Anwar oh God, why answer a post that is over a year old
0
s = input()
if "a" in s:
print("Match")
else:
print("No match")
0
Try this
s = input()
if "a" in s:
print("Match")
else:
print("No match")
- 1
WORKS FINE!
n = int(input())
result = 0
inputAsString = str(n)
inputLength = len(inputAsString)
for i in range(inputLength):
result += int(inputAsString[i])
print(result)