Answers for Python December 2022 QP
GE3151 | Python Programming — Answer Guide GE3151 / PYTHON Part A Q11 Q12 Q13 Q14 Q15 November / December 2022 · Question Paper 30509 Problem Solving & Python Programming Exam-ready answers with algorithms, explanations, and runnable Python examples. Part B includes both alternatives wherever the paper says “OR”. 10 Part A answers 5 Part B questions Dark study interface Part A 10 × 2 marks Q1 Sum of first N natural numbers Algorithm: Read N; initialize total=0; repeat i from 1 to N and add i to total; print total. Formula: N(N+1)/2 . N = int(input("N: ")) total = N * (N + 1) // 2 print(total) Q2 Top-down vs bottom-up Top-down: begin with the overall problem and decompose it into smaller subproblems; refine step by step. Bottom-up: develop and test small reusable components first, then combine them into a complete solution. Q3 Slicing operator Slicing extracts a sequence portion using [start:stop:step] ; stop is excluded. items = [10, 20, 30, 40, 50] pri...