Код будет go таким,
name = ['peter', 'jay']
for i in range(0,4):
user = str(input("Enter UserID: "))
if user in name:
print ("welcome back " + user)
break
elif i !=3:
print ("wrong input, you have", (3-i) , "more tries, please try again")
else:
print ("wrong input, you have no more chances")