[Solved] Checking for elements in list

The Main approach for checking elements of a list in a string is : s=””‘<a href=”https://ertfwetwer” target=”_blank”>[Nerve Center]</a>”’ my_list=[‘href’,’a’] def checker(mylist, my_string) new = list() for i in mylist: if i in my_string: # if elements is in string (you can check only special elements ) print i ,’is in string’ new.append(i) #storing result to … Read more

[Solved] Finding the position of an item in another list from a number in a different list

You can do something like this : input_num = 123 list1 = [0, 1, 2, 3, 4] # if list1 is not dervied from input number list2 = [“0”, “hello”, “my”, “name”, “is”, “Daniel”] print(‘ ‘.join([list2[list1.index(int(ind))] for ind in str(input_num)])) This will result in : hello my name Also, i would suggest you to look … Read more

[Solved] Accessing ruby elements

arr[-1] gives you the last element of arr, arr[-2] the second-to-last element and so on. arr[2, 3] gives you from the element at index 2, three elements of arr arr[2..3] gives you from the element at index 2 to the element at index 3 2 solved Accessing ruby elements