I am a beginner to python and this is one of the assignments my teacher has given me.
"Given an integer input, AND a list of numbers (you need a single input then the new list input),
Then print yes
if the input is present in the list and then print all the index positions that it appears!
If the given integer is not present, just print no"
I'm pretty sure i've gotten the code right but the tests keep failing because my output is not printing in the same line.
This is my code:
N = int(input())
a = [int(s) for s in input().split()]
for N in a:
for i in range(0,len(a)):
if a[i]==N:
[print("Yes",i)]
else:
print("no")
i'm posting an image of the tests to give more context of what the problem i'm facing is. test fails I hope this is enough context for ya'll to help me out.