Interview - Shell trading : applied Python
I found a recent query asked in an interview with SHELL TRADING & SUPPLY for the role of Quantitative Analyst (Power & Gas Desk) and was the second Round , which is Technical Panel | 12 March 2026.
This round is that you are seated at a glass table in a meeting room and three interviewers face you ( a senior quant, a trading desk lead, and an HR partner).
You are handed an iPad showing a single code snippet.
No phones, no AI tools, no internet access.
You have like 60 seconds (the more it takes you to reply, the worse ....) to explain your answer out loud... (try not to shake from stress).
Only to face another question.
So the question is about this following Python expression:
pythonx = [a] + (b or [])
They first ask what does this line do? To explain it in plain English.
Then you reply.
And if you don't reply , they tell you the answer... where you say , you knew it but your mind got blocked .
Anyways, and then they ask you to give an example of where this code would be useful on an energy trading desk.
So again you can't use AI. " If we allowed you to use AI, we wouldn't need to hire you" is their answer.
So the answer, for the record , is this:
That this code creates a list that always starts with a.
If b is a non-empty list, it gets appended.
if b is None or empty, it defaults to an empty list so we dont get an error.
This is a safe way to build a list without crashing the program.
On a trading desk, 'a' could be today's base-load power contract, and 'b' could be an optional list of additional hedges . So, every day, the desk must trade one core electricity contract ( that's 'a', it's always there). But some days there are also extra gas or peak-hour deals on the table ( that's 'b'). Some days 'b' has things in it, some days it's empty. The line of code just starts the list with the one deal we always need, and then places the extras if there are any and if there aren't, don't break the code.
11
5 comments
Chinedu Okafor
3
Interview - Shell trading : applied Python
powered by
The Energy Data Scientist
skool.com/software-school-for-energy-7177
A personalized program to build a quantitative career in the energy sector. Industry-based courses, job-preparation, and 1-on-1 support from Dr Spyros
Build your own community
Bring people together around your passion and get paid.
Powered by