TORONTO KIDS COMPUTER CLUB | Uncategorized
1
archive,paged,category,category-uncategorized,category-1,paged-8,category-paged-8,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.10.0,vc_responsive

Uncategorized

14 Apr PMCA Saturday 18:30 Python Homework 22.04.09.

Question 1: The hailstone sequence starting at a positive integer n is generated by following two simple rules. If n is even, the next number in the sequence is n/2. If n is odd, the next number in the sequence is 3*n+1. Repeating this process, we generate the hailstone sequence. Write a recursive function hailstone(n) which prints the...

Read More

08 Apr PMCA Saturday 18:30 Python Homework 22.04.02.

Question 1: Use recursion to write a function divides_all that consumes a list of positive integers seq and a positive integer factor. Your function should produce True if every item in seq is a multiple of factor and False otherwise. The helper function is_multiple has been provided for you. Question 2: Use recursion to write a function reverse that consumes a list seq and produces a new...

Read More