Topic 0: Python Fundamentals
Raft Regatta ’25
Nixor College Raft Regatta 2025
AI Auction Guide
Topic 0
Python Fundamentals
Introduction
Before constructing neural networks or designing bidding algorithms, it is essential to
master the tools of the trade. The implementation of every AI model and logic gate in
this competition relies on a robust understanding of Python.
This topic covers the syntactical and logical foundations required to manipulate data,
control program flow, and structure code modularly. Just as a raft requires a solid frame
before it can float, your AI requires clean, efficient code to function.
1
0.1 Learning Objectives
By the end of this topic, students will be able to:
• Utilize basic input and output operations to interact with the user.
• Implement control flow using conditionals and loops to handle logic and repetition.
• Organize data effectively using Lists (1D and 2D) and Dictionaries.
• Decompose complex problems into modular Functions.
• Manipulate text data using String functions.
2
0.2 Input, Output, and Conditionals
At its core, a computer program accepts data, processes it based on logic, and produces a
result. In Python, the input() function retrieves data as a string, which often requires
type casting (using int() or float()) for mathematical operations.
1
Topic 0: Python Fundamentals
Raft Regatta ’25
Conditionals (if, elif, else) allow the program to make decisions. They branch
the execution path based on whether specific boolean conditions are true or false. This
logic is the precursor to the decision-making ”brains” you will build in Topic 2.
Exercise 0.1 – Min/Max Logic
Task: Ask the user for 5 distinct numerical inputs. The program must evaluate
these inputs and output only the largest number and the smallest number among
them.
Marking Criteria:
• Correct usage of a loop or individual input statements to gather data.
• Logic accurately identifies the maximum and minimum values without using
built-in max() or min() list functions (logic must be demonstrated).
• Program handles negative numbers correctly.
Exercise 0.1 needs to be signed off by a TA.
2
Topic 0: Python Fundamentals
3
Raft Regatta ’25
0.3 Loops and Iteration
Loops allow code to repeat, which is vital for processing datasets or images pixel-by-pixel.
• For Loops: Used for definite iteration (e.g., repeating a specific number of times
or iterating through a list).
• While Loops: Used for indefinite iteration, running as long as a condition remains
true.
• Nested Loops: A loop inside another loop. This is critical for working with 2D
structures, such as the grids of pixels in the CNNs you will build in Topic 1.
Exercise 0.2 – Pattern Generation
Task: Output a ”fish” shape of a size defined through user input, using a symbol
also defined by the user.
Example Input: size = 4, symbol = #
Expected Output:
#
###
#####
#######
#####
###
#
###
#####
#######
Marking Criteria:
• Correct implementation of nested loops to handle rows and character repetition.
• Dynamic adjustment: The shape scales correctly if the user enters a different
size (e.g., 3 or 5).
• Proper alignment (padding/spaces) to create the visual shape.
Exercise 0.2 needs to be signed off by a TA.
4
0.4 Functions and Modularity
As code grows complex, it must be organized. Functions are reusable blocks of code that
perform a specific task. They take parameters (inputs), process them, and return a
result. Breaking a large problem into smaller functions (decomposition) makes debugging
easier and code cleaner—a practice essential when integrating the Auction API later in
the project.
3
Topic 0: Python Fundamentals
Raft Regatta ’25
Exercise 0.3 – The Robot Navigator
Task: Create a simulation on a 3 × 3 2D plane.
1. A ”Robot” starts at position 0,0 (Top Left).
2. The program continuously takes inputs: U (Up), D (Down), L (Left), R
(Right).
3. Constraint: You must create a specific function for each movement type.
4. The robot must not go out of bounds. If a move is invalid, the robot stays in
place.
5. Display the robot’s position in the plane (e.g., using a grid printout) after
each move.
Marking Criteria:
• Implementation of four distinct functions for movement.
• Correct boundary checking (the robot never crashes or errors out).
• Visual representation of the grid updates correctly after every input.
Exercise 0.3 needs to be signed off by a TA.
4
Topic 0: Python Fundamentals
5
Raft Regatta ’25
0.5 Data Structures: Lists
Lists are ordered collections of items.
• 1D Lists: A simple sequence, useful for storing a queue of items or names.
• 2D Lists: A list of lists, forming a matrix. This structure is foundational for
understanding how images are stored (height × width × channels) in Topic 1.
Exercise 0.4 – List Manipulation
Task A: Continuously take a student’s name as input from the user until the user
enters 0. Once finished, output the total number of names entered.
Task B: Using the array (list) created in Task A, write a program to find and
output the shortest name in the list.
Marking Criteria:
• Correct use of a while loop for indefinite input.
• Accurate counting of list elements.
• Logic correctly identifies the string with the minimum length.
Exercise 0.4 needs to be signed off by a TA.
Exercise 0.5 – Sales Analytics (2D Lists)
Task: Ask the user for the total number of salespersons in a shop.
1. For each salesperson, store their sales figures for every month of the year (12
columns).
2. Output: The average sales of each salesperson.
3. Output: The average sales for the entire store over the whole year.
Marking Criteria:
• Correct creation and population of a [Salesperson][Month] 2D list.
• Correct use of nested loops to calculate row averages (per person) and the
global average.
Exercise 0.5 needs to be signed off by a TA.
6
0.6 String Functions
Text processing is often required to parse labels or handle API responses. Strings in
Python are immutable sequences of characters. Key operations include slicing (extracting
parts of a string), reversing, and checking equality.
5
Topic 0: Python Fundamentals
Raft Regatta ’25
Exercise 0.6 – String Logic
Task A: Take an input string from the user and output the reverse of that string.
Task B: Take an input string from the user and output whether it is a palindrome
(a word that reads the same backward and forward).
Marking Criteria:
• Efficient string reversal (using slicing or loops).
• Correct boolean logic for the palindrome check.
Exercise 0.6 needs to be signed off by a TA.
7
0.7 Dictionaries
While lists order data by index, Dictionaries store data in key-value pairs. This allows
for fast data retrieval using a unique key (e.g., an item’s name) rather than a numerical
position. Dictionaries are the Python equivalent of a hash map and are heavily used
when handling JSON data from the Auction API in Topic 2.
Note: There is no graded exercise for Dictionaries, but understanding them is required
for parsing API data in Topic 2.
8
0.8 Reflection
Mastering these fundamentals ensures that when you face the complexities of Convolutional Neural Networks and Mathematical Bidding Strategies, you are struggling with
the concepts, not the code.
6