[OPTIONAL] Prime numbers

[OPTIONAL] Prime numbers#

A number is prime if it has exactly 2 factors i.e., the number should be divisible by just 1 and the number itself.

Write a function called prime_numbers which takes as input an integer num and returns a list of prime numbers from the numbers 2 to num (inclusive). Nested loops will help!

Function Name: prime_numbers

Parameter: num - A positive integer up to which we have to look for prime numbers

Return: A list of prime numbers from 2 to num (inclusive).

Sample Input:

10

Sample Output:

[2, 3, 5, 7]