Now you know what sets and lists are, you can learn more about them! Try the following tasks and if you get stuck, feel free to check out more about sets and lists to find the tools you need to solve problems.
B. Try these problems and see how many you can solve.
Given two lists of numbers, count how many numbers of the first one occur in the second one.
Given two lists of numbers, find all the numbers that occur in both the first and the second list. Print them in ascending order.
Given a list of numbers, find and print all its elements that are greater than their left neighbor.
Given a list of non-zero integers, find and print the first adjacent pair of elements that have the same sign. If there is no such pair, print 0.
#Task 1 l1 = [60,7,4,74] l2 = [42,67,7,74] oekl = list((set(l1).intersection(set(l2)))) print("Task 1: \n") ok = len(oekl) print(ok) #Task 2 ll1 = [60,7,4,74] ll2 = [42,67,7,74] okl = list((set(ll1).intersection(set(ll2)))) print("\nTask 2: \n") print(okl) #Task 3 lll1 = [60,7,4,74] print("\nTask 3: \n") beep = lll1 for i in lll1: if i > beep: print(i) beep = i #Task 4 llll1 = [60,7,-4,74] beepy = 0 finish =  for i in llll1: if i > 0 and beepy > 0: finish.append(beepy) finish.append(i) if i < 0 and beepy < 0: finish.append(beepy) finish.append(i) beepy = i finish1 = finish finish2 = finish print("\nTask 4:\n") print(finish1, finish2)
2. numbers = [1, 3, 4, 2,6,4,43,6,3] numbers2= [1,6,3,5,67,4,6,3] for x in numbers2: numbers.append(x) numbers.sort(reverse = True) print(numbers)
How is the union method used? I think that's the solution to one of the problems.
How many elements should we include in the list in homework 3, also why is there no homework including sets?
Do we have to write it here??