Categories
Easy Problems

โจทย์เขียนโปรแกรมข้อ VZ0081

จงเขียนฟังก์ชั่นที่หา index ของ string ที่ต้องการหา ว่าอยู่ใน index ไหนใน array ของ string ที่ป้อนเข้า หากไม่เจอให้ส่ง -1 ออกมา

Examples

findIndex([“how”,”are”,”you”],”you”) 

findIndex([“red”,”blue”,”green”],”blue”)

เฉลย ด้วยภาษา Python

Leave a Reply