lists
clean(myList)
- Removes empty strings from a list.
Parameters
myList(list): The list that needs to be cleaned.
Return
- (list): The cleaned list.
Example
myList = ["", "cleans", "", "empty", "", "items", ""]cleanList = myList.cleancleanList = clean(myList)print(cleanList)Result:
["cleans", "empty", "items"]hasvalue(myList, item)
- Returns 1 if the list has a value else return 0.
Parameters
myList(list|map): The list that contains the item.item(any): The item that is contained in the list.
Return
- (number): 1 if the item is found else 0.
Example
myList = ["dog", "cat", "monkey"]if myList.hasvalue("cat") then print("The cat has been found")if hasvalue(myList, "cat") then print("The cat has been found")Result:
The cat has been foundThe cat has been found