Answer to Question #281954 in Python for Grizz

Question #281954

2. Found Ya!

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

  1. Create two variables assigned to an input() function. The first one shall accept any integer from 0-9 and the other one shall take a random positive integer. All the needed values are to be inputted in one single line.
  2. Using loops, identify if the number (0-9) is present in the given positive integer. If it is found, print "Yes"; else, print "No".
  3. 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.
1
Expert's answer
2021-12-22T14:24:11-0500
wanted = int(input("Enter the first integer: "))


list_of_numbers =input().split(' ')



if wanted in list_of_numbers\\:
    print("Yes")
print("No")

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS