print("\n+++++++++++++++\n\n") ## silly formatting stuff for lecture myList = [ (x**2 , y**3) for x in range(5) for y in range(4) ] tempList = [ ] hisList = [ ] ## to hold a bunch of integers entered at the keyboard print("how many numbers would you like to give me?") count = int(input()) print("you told me you'd like to count "+str(count)+ " things.") for reading in range(count): ## assuming count > 0 !!!!!! print("Please enter an integer") blah = input() hisList.append(int(blah)) ## trusting that they entered an integer !!! print(hisList) total = 1 for x in hisList: total *= x print("The product of all those integers = " + str(total)) ## let's make a list of all the y-values in myList y_values = [] for tuply in myList: if tuply[1] not in y_values: y_values.append(tuply[1]) print("so the list of y values = " +str(y_values)+ "\n") for y in y_values: for tuply in myList: if tuply[1] == y: tempList.append(tuply) print(tempList) tempList.clear() print("\n+++++++++++++++\n") ## ditto, as at the top