Needle in the Haystack
by CodeChum Admin
Let's now try finding a certain digit into an integer! Come and join in on the fun and code with me!
Instructions:
Input two integers in one single line. The first inputted integer must be within 0-9 only.
Using loops, identify if the first inputted integer (0-9) is present in the second inputted integer. If it is found, print "Yes"; otherwise, print "No". Tip: If the number is already found even without reaching the end of the loop, use the break keyword to exit the loop early for a more efficient code.
Input
A line containing two integers separated by a space.
1·231214238
Output
A single line containing a string.
Yes
a, b = map(str, input().split())
test = True
for i in b:
if i == a:
test = False
if test: print("No")
else: print("Yes")
Comments
Leave a comment