Consolidation

We’ve now reached the fifth week of SCIF10002!

This marks the end of the basics section of the course. Over the next few weeks, we’ll begin shifting our focus away from Python’s built-in features and towards powerful external packages, such as numpy, matplotlib and pandas, that will no doubt be invaluable in your future studies and professional work.

To wrap up this section of the course, we will apply the skills we’ve learned so far to a set of applied challenges. This will give you an opportunity to consolidate your understanding and get a feel for the kinds of coding tasks you may encounter beyond the classroom.

Table of Contents

Today’s Material

For this week’s class, we’ll be doing something a little different from previous weeks.

Below, you’ll find three challenges. The challenges are organised by course; data science, chemistry and physics.

Your goal is to attempt at least one challenge. Once you have read the Guidance section below, try the challenge for your own course. If you manage to finish the challenge for your course, move onto the challenges for the other courses. None of the challenge notebooks assume course-specific background knowledge.

Important: For this task, you may only use material covered in the previous 4 week’s classes. To solve the challenge problems, you may use any content from the beginner, intermediate, or advanced notebooks. However, every challenge can be completed using only the material in the beginner notebooks, so don’t worry if you haven’t looked at the others. The tasks are designed to be accessible to everyone!

Please Note: These challenges are designed to difficult! Do not worry if you are unable to complete a challenge in the time given. The important thing is that you are building resilience and practicing problem-solving skills - everything else is secondary!

Guidance

You will find that the challenge problems this week are much more open-ended than those you have encountered in previous classes. At first, this might feel a bit intimidating, but please do not fret - you already have all the skills necessary to complete the tasks!

Here are some general tips to help make the challenges feel less daunting:

Plan before you code: Before writing any code, try taking notes about the background material. Once you understand the background material, think about how you might approach the task by hand, and jot the steps you would perform down on paper.

Clarify inputs and outputs: When getting started, think about the following questions: - What information do I have before I start coding? (These are likely my inputs.) - What do I want my code to produce? (This is my output.)

Look for structure and repetition: When converting your thoughts to code, consider the below: - Which steps of the computation are repetitive? (Think loops!) - Which steps of the computation are self-contained? (Perhaps, I should use a function for these…)

Divide and conquer: Try to break the task down into smaller, more manageable chunks, and solve each piece one at a time before putting them together.

Talk things through: If you’re struggling to get started, try talking the question through with a peer or class tutor. You might be surprised how much this helps to organise your thoughts!

Use resources: Don’t be afraid to use google or Python documentation when you’re thinking about the best way to implement a solution. Sometimes the act of googling alone can help spark new ideas.

Trust your own process: Try to avoid using AI when deciding how to structure your code. You will find it much easier to understand and refine your work if the structure comes from your own reasoning.

Above all, remember that coding can be hard! At times, it might feel like you’re running into the same problem over and over without making much progress. If you feel this way, don’t worry - this is a perfectly normal part of the process. If you keep trying, you will get there!

Getting Help

As always, to get more help you can view the Python API or the W3 schools series on Python. Another way to get help if you are ever unsure what a function is doing is to use thehelp function in the Python terminal like so:

In class, you can ask for help from the lecturer, demonstrators and your peers around you. We advise you do not ask AI for help unless you are really stuck.