I want to search an array for a string and get its index number.
li = ["New Year's Day", 'Lohri', 'Pongal', 'Makar Sankranti', 'Guru Govind Singh Jayanti', 'Republic Day', 'Chinese New Year', "Valentine's Day", 'Vasant Panchami', 'Shivaji Jayanti']
So what should I write to make it return the index number
like I call a faction check = checkindex('Pongal')
and this should return 2. How do I write this function.
You don't need a separate function for that
li.index('Pongal')
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments