I have the following code that is designed to take 4 words from the user and search for all of them through the lists defined in the beginning, eventually returning with the list that contains all words. My issue is that when I def() a block of code, python does not replace the argument within the code, for example:
Were I to define something as:
def Search(var):
var.Ccount(example)
Then python would not replace var.count with test.count if I were to run Search(test)
The full code is seen below:
list1 = ['q','triangle','lambda','lightning','horse','xy','cdot']
list2 = ['umlau','q','backcdot','swirl','whitestar','xy','question']
list3 = ['copyright','eye','swirl','k','r','lambda','whitestar']
list4 = ['6','paragraph','tb','horse','k','question','smiley']
list5 = ['trident','smiley','tb','cdot','paragraph','antenna','blackstar']
list6 = ['6','umlau','railroad','ae','trident','nu','omega']
is1 = 0
is2 = 0
is3 = 0
is4 = 0
symbol1 = str(input("Symbol 1: \n"))
symbol2 = str(input("Symbol 2: \n"))
symbol3 = str(input("Symbol 3: \n"))
symbol4 = str(input("Symbol 4: \n"))
def search(n):
is1 = n.count(symbol1)
is2 = n.count(symbol2)
is3 = n.count(symbol3)
is4 = n.count(symbol4)
search(list1)
if is1 == 1 and is2 == 1 and is3 == 1 and is4 == 1:
correctlist = list1
search(list2)
if is1 == 1 and is2 == 1 and is3 == 1 and is4 == 1:
correctlist = list2
search(list3)
if is1 == 1 and is2 == 1 and is3 == 1 and is4 == 1:
correctlist = list3
search(list4)
if is1 == 1 and is2 == 1 and is3 == 1 and is4 == 1:
correctlist = list4
search(list5)
if is1 == 1 and is2 == 1 and is3 == 1 and is4 == 1:
correctlist = list5
search(list6)
if is1 == 1 and is2 == 1 and is3 == 1 and is4 == 1:
correctlist = list6
print (correctlist)