PROGRAMMING 101

Learning Goal: I'm working on a programming and need to help me learn.

Certainly! Here's an example of a programming quiz question worth 10 marks. This question is focused on Python programming:


Question:

Consider a list of integers:

python

numbers = [4, 7, 1, 9, 3, 5, 2, 8, 6]

Write a Python program to accomplish the following tasks:

  1. Find and print the maximum value in the list.
  2. Calculate and print the sum of all even numbers in the list.
  3. Create a new list containing the square of each number in the original list.
  4. Sort the original list in descending order.
  5. Implement a function is_prime(num) that takes an integer num as an argument and returns True if the number is prime and False otherwise.