Final Exam Review_Part Two.docx

Final Exam Review_Part Two.docx - Final Exam Review Chapter...

This preview shows 1 out of 3 pages.

Final Exam Review Chapter Seven – One Dimensional Lists Write a function that will accept two arguments: a list and a number (n). Assume that the list contains numbers. The function should display all of the numbers in the list that are greater than the number (n) def main(): number = 5 number_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] display_larger_than_n_list(number, number_list) print('Number:', number) print('List of numbers:\n', number_list, sep='') print('List of numbers that are larger than ', \ number, ':', sep='') def display_larger_than_n_list(n, n_list): larger_than_n_list = [] for value in n_list: if value > n: larger_than_n_list.append(value) print(larger_than_n_list) main()
Image of page 1

Subscribe to view the full document.

Chapter 7 – 2D Lists The Lo Shu Magic Square is a grid with 3 rows and 3 columns, shown below. The Lo Shu Magic Square has the following properties: The grid contains the numbers 1 through 9 directly The sum of each row, column, and diagonal all add up to the same number In a program, you can simulate the Lo Shu Magic Square using a 2D List. Write a function that accepts a 2D List as an argument and determine whether the list is a Lo Shu Square or not. Test your function in a program.
Image of page 2
Image of page 3
You've reached the end of this preview.
  • Fall '12
  • DavidBrown
  • Room number, Lo Shu square, Lo Shu Magic Square

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern