Skip to content

Tag: python

check element in list and return a value and store in another list

I am trying to identify few IP accordingly, the requirement as below: There is a list of IP called ip_addresses. There is a list of registered IP called registered_list. There is a list of banned IP called banned_list. If the element in ip_addresses in registered_list, return 1 and store in another list. If t…

Binary search through string tuple in list

I’m trying to do a binary search through a list of tuples, when I give a inputq = “BB”, it is not show a correct search. This is my data: This my code: when I give inputq = “BB” the output it always show like this: (‘BF’, ‘Burkina Faso’, 13.0, -2.0) I woul…

How do I print a dictionary’s keys based on its value?

So, I’ve created a dictionary of key, value pairs for course name and student ID respectively. I want to be able to iterate through the dictionary and print all of the keys (course names) that contain a particular value (student ID). So, here’s the first initialization of variables followed by ask…

how to search in List which contains tuples?

I am having a list which having tuple object and I need to search the list for all tuples which contain the string typed in search box. can anyone please help me into this? I created one search box which having binding function. I can get the text from search box. but for the same text I need to find