Valid email format extraction from the list
emails_list = ["[email protected]", "[email protected]", "[email protected]", "[email protected]"]
new_emails_list = []
for email in emails_list:
if email.endswith("@gmail.com") or email.endswith("@yahoo.com"):
new_emails_list.append(email)
print(new_emails_list)