Write a program to generate 10 random numbers from -100 to 100. Save the randomly generate numbers in a list. Create a function to count how many odd numbers are in a list. Create a function to count how many even numbers are in the list. Create a function to sum up all the even numbers in the list as well.
Write a function print_triangular_numbers(n) that prints out the first n triangular numbers. A call to print_triangular_numbers(5) would produce the following output:
1 1
2 3
3 6
4 10
5 15
Write a function, is_prime, which takes a single integer argument and returns True when the argument is a prime number and False otherwise. Add tests for cases like this:
test(is_prime(11), True)
test(is_prime(35), False)
test(is_prime(19911129), True)
Write a function sum_of_squares(xs) that computes the sum of the squares of the numbers in the list xs. For example, sum_of_squares([2, 3, 4]) should return 4+9+16 which is 29:
test(sum_of_squares([2, 3, 4]), 29)
test(sum_of_squares([ ]), 0)
test(sum_of_squares([2, -3, 4]), 29)