📌 Questions Overview & Requirements
Extract the date of birth from a South African ID number.
YYMMDDSSSSCAZ
YY → Year
MM → Month
DD → Day
DD/MM/YY
Determine the gender from the ID number.
Extract digits 7–10 (the sequence number):
sequence = int(id_number[6:10])
If sequence < 5000 → Female
If sequence ≥ 5000 → Male
Prompt the user to enter a shape name.
Input cannot be empty
Must match a valid shape, such as: "circle", "square", "triangle", "rectangle", "pentagon"
Return the validated shape
Draw a multiplication triangle up to n.
For row i, the values are:
i * 1, i * 2, i * 3, ... , i * i
1
2 4
3 6 9
4 8 12 16
5 10 15 20 25
Draw a pyramid of stars with height n.
For row i (starting from 1):
Number of stars: 2*i - 1
Number of leading spaces: n - i
Return the nth Fibonacci number using recursion.
F(0) = 0
F(1) = 1
F(n) = F(n-1) + F(n-2)
Return different outputs depending on divisibility.
If n % 3 == 0 → "Fizz"
If n % 5 == 0 → "Buzz"
If divisible by both:
n % 3 == 0 and n % 5 == 0 → "FizzBuzz"
Otherwise return n
Determine if a number is prime.
A number is prime if:
n > 1 AND it has no divisors other than 1 and n.
Check divisibility from 2 to √n:
for i in range(2, int(sqrt(n)) + 1):
if n % i == 0 → Not prime
Return the factorial of n using recursion.
0! = 1
n! = n × (n - 1)!
5! = 5 × 4 × 3 × 2 × 1 = 120
Draw a triangle of prime numbers up to n rows.
Generate primes in ascending order
Row i contains i prime numbers
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47
Draw Pascal’s Triangle up to n rows.
Each element is a binomial coefficient: C(n, k) = n! / (k! (n - k)!)
Or recursively: pascal[i][0] = 1 pascal[i][i] = 1 pascal[i][j] = pascal[i-1][j-1] + pascal[i-1][j]
1
1 1 1 2 1 1 3 3 1 1 4 6 4 1