Certainly! Here’s an example of a programming quiz question worth 10 marks. This
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:
pythonCopy codenumbers = [4, 7, 1, 9, 3, 5, 2, 8, 6]
Write a Python program to accomplish the following tasks:
Find and print the maximum value in the list.
Calculate and print the sum of all even numbers in the list.
Create a new list containing the square of each number in the original list.
Sort the original list in descending order.
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.