Topic outline

  • General Information and Announcements

    ASSESSMENT & MARKING CRITERIA

    There will be five in-term tests in weeks 3, 5, 8, 10, and 12, each of them counting 20% towards your final mark. More information under the "Assessments" tab below.

    FEEDBACK

    Your feedback comes in many forms:

    • Weekly Quizzes with specific feedback
    • Weekly lab sheets
    • Additional list of exercises (with solutions in due time) for you to practice
    • Availability to ask questions during or after lectures
    • Participation in IT Labs throughout the week - these provide you with a unique opportunity to work with other students and explore ideas from the module in further depth. Labs are also a more relaxed environment for you to get advice and guidance for your course from academic members of staff, who will provide helpful comments.
    • Personalised feedback during office hours - Office hours are also an opportunity for you to get 1 on 1 help for any additional support you may need. You can also contact the lecturer by email with any queries you might have.

    Feedback is not just written comments on a piece of work. Please make sure that you actively engage with all these feedback opportunities, as they are there to help you learn and gain confidence in tackling unfamiliar problems!

    MEET YOUR LECTURERS

    Your lecturers for the module are Prof. Thomas Prellberg and Dr Matthew Lewis.

    TPThomas is a Professor of Mathematics at QMUL, and a member of the Dynamical Systems & Statistical Physics research group. His research interests span several areas of mathematics and theoretical physics, including combinatorics, statistical physics, and the mathematical and computational modelling of polymers, where he has published over 120 papers. Throughout his academic career he has used extensively computer programming for computer simulations, designing and implementing algorithms for large-scale simulations. At QMUL he has taught Python modules for several years, modules he also designed and created.


    MLMatthew is a Lecturer in Mathematical Sciences at QMUL. He obtained his PhD in 2019 at Cardiff University with thesis Stability of Solutions of a One-Dimensional p-Laplace Equation with Periodic Potential.  Throughout his research, he has used Python to design numerical algorithms to evaluate solutions to nonlinear differential equations.  He has taught programming modules at QMUL over the last couple of years, helping design and structure material for these courses.
    The on-campus IT labs for the module are supported by academic staff Dr Mark Walters, Dr Fatemeh Parsa, Dr Subhajit Jana, Dr Omer Bobrowski, Dr Masanori Hanada, Dr Vincenzo Nicosia, and research students Evelyn Lira Torres, Danilo Riccio, and Elisa Scanu.

    READING LIST

    The lecture notes and lab materials will define the content of the module, but if you would like some additional reading material, then we recommend two books:

    • View all general news and announcements from the your module leaders.
  • Assessment Information

    There will be five in-term tests (counting 20% each), in weeks 3, 5, 8, 10, and 12.

    The in-term tests will have a quiz format. You will be able to practice quizzes in every week. 


    Weekly quizzes are an excellent way of checking if you master the minimum (and a way to practice for the tests), but the bulk of the learning will take place while you practice your coding skills (lab and additional exercises).

    • In weeks 3, 5, 8, 10, and 12 we will upload the respective tests. You will have a 24h window from Wednesday 11am to Thursday 11am to work on a 2h assessment. For details, please refer to the respective test sections.
  • Week 3 Test

    Your week 3 mid-term test will take place over a 24h period, starting on Wednesday, October 11, 11am and ending on Thursday, October 12, 11am.

    Once you start the test, you will have two hours to complete it or until the 24h period ends, whatever happens earlier.

    While the test might be substantially shorter to complete, please assume that you will need about 2 hours from the moment you start to the moment you submit it.

    The test covers all material in lectures and tutorials from week 1 and week 2.

    The test is open book. This means:

    • You may access any printed and online resources, however,
    • You may not communicate, nor attempt to communicate, with anyone else, nor solicit assistance in any way (e.g. via email, Discord, WhatsApp, Chegg, Stackexchange, etc.).

    The test itself will be in the format of a QMPlus quiz (just like the weekly quizzes). You are encouraged to do rough work on paper or within Jupyter Notebook.

  • Week 5 Test

    Your week 5 mid-term test will take place over a 24h period, starting on Wednesday, October 25, 11am and ending on Thursday, October 26, 11am.

    Once you start the test, you will have two hours to complete it or until the 24h period ends, whatever happens earlier.

    While the test might be substantially shorter to complete, please assume that you will need about 2 hours from the moment you start to the moment you submit it.

    The test covers all material in lectures and tutorials from week 1 to week 4.

    The test is open book. This means:

    • You may access any printed and online resources, however,
    • You may not communicate, nor attempt to communicate, with anyone else, nor solicit assistance in any way (e.g. via email, Discord, WhatsApp, Chegg, Stackexchange, etc.).

    The test itself will be in the format of a QMPlus quiz (just like the weekly quizzes). You are encouraged to do rough work on paper or within Jupyter Notebook.

  • Week 8 Test

    Your week 8 mid-term test will take place over a 24h period, starting on Wednesday, November 15, 11am and ending on Thursday, November 16, 11am.

    Once you start the test, you will have two hours to complete it or until the 24h period ends, whatever happens earlier.

    While the test might be substantially shorter to complete, please assume that you will need about 2 hours from the moment you start to the moment you submit it.

    The test covers all material in lectures and tutorials from week 1 to week 6.

    The test is open book. This means:

    • You may access any printed and online resources, however,
    • You may not communicate, nor attempt to communicate, with anyone else, nor solicit assistance in any way (e.g. via email, Discord, WhatsApp, Chegg, Stackexchange, etc.).

    The test itself will be in the format of a QMPlus quiz (just like the weekly quizzes). You are encouraged to do rough work on paper or within Jupyter Notebook.

  • Week 10 Test

    Your week 10 mid-term test will take place over a 24h period, starting on Wednesday, November 29, 11am and ending on Thursday, November 30, 11am.

    Once you start the test, you will have two hours to complete it or until the 24h period ends, whatever happens earlier.

    While the test might be substantially shorter to complete, please assume that you will need about 2 hours from the moment you start to the moment you submit it.

    The test covers all material in lectures and tutorials from week 1 to week 9.

    The test is open book. This means:

    • You may access any printed and online resources, however,
    • You may not communicate, nor attempt to communicate, with anyone else, nor solicit assistance in any way (e.g. via email, Discord, WhatsApp, Chegg, Stackexchange, etc.).

    The test itself will be in the format of a QMPlus quiz (just like the weekly quizzes). You are encouraged to do rough work on paper or within Jupyter Notebook.

  • Week 12 Test

    Your week 12 mid-term test will take place over a 24h period, starting on Wednesday, December 13, 11am and ending on Thursday, December 13, 11am.

    Once you start the test, you will have two hours to complete it or until the 24h period ends, whatever happens earlier.

    While the test might be substantially shorter to complete, please assume that you will need about 2 hours from the moment you start to the moment you submit it.

    The test covers all material in lectures and tutorials from week 1 to week 11.

    The test is open book. This means:

    • You may access any printed and online resources, however,
    • You may not communicate, nor attempt to communicate, with anyone else, nor solicit assistance in any way (e.g. via email, Discord, WhatsApp, Chegg, Stackexchange, etc.).

    The test itself will be in the format of a QMPlus quiz (just like the weekly quizzes). You are encouraged to do rough work on paper or within Jupyter Notebook.

  • Module description

    This is a first module in computer programming in Python, a widely used programming language, an essential professional skill for Mathematicians and Statisticians. Students will learn to understand the basic logic of computer programming, read and implement basic code and write programs to solve problems coming from real world situations using theoretical results from their mathematics and statistics modules. These computational skills are applicable to any role that requires quantitative analysis and evidence-based decision making.

  • Syllabus

    The programming language used for this module is Python, via the web-based Jupyter Notebook application. Please see the week 1 exercise sheet for information on how to access Jupyter Notebook on college computers and/or install it on your personal computer. 

    The content of the module is (roughly) as follows; more details are given in the week 1 lecture notes:

    • Week 1: Introduction to Jupyter Notebook, Numbers and Variables
    • Week 2: Sequences, Lists, and Arrays
    • Week 3: Plotting data - first test
    • Week 4: Functions
    • Week 5: Logic and Loops - second test
    • Week 6: Strings, text processing, file I/O
    • Week 7: Revision
    • Week 8: Designing an Algorithm - Euclid's Algorithm - third test
    • Week 9: Searching and Sorting Algorithms and ...
    • Week 10: ... Algorithmic Complexity - fourth test
    • Week 11: Root finding algorithms
    • Week 12: Working with Spreadsheets - fifth test
  • Learning Outcomes

    This is a first introduction to computer programming. Learning outcomes include:

    • To apply basic elements of computer programming to analyse data
    • To solve problems using computational methods
    • To simulate complex systems on a computer

    • Introductory concepts of computer programming in a widely used programming language
    • Computational methods for analysing data, modelling complex systems and solving problems coming from real life situations
    • Simple data types, composite data types, variables, functions, file input/output
    • Branching (if-else), loops (while), List comphrehension
    • Applications, e.g., Euclid's algorithm, sorting, root finding (bisection, Netwon,) algorithmic complexity

    • Apply analytical skills to investigate unfamiliar problems
    • Use technologies to access and interpret information effectively
    • Use information for evidence-based decision-making
    • Produce analyses, which are grounded in evidence
    • Develop key transferable skills to identify and pursue career goals
    • Week 1

      What's covered in this week?

      • Introduction to the module
      • Jupyter Notebooks
      • Using Python as a calculator
      • Using Python to plot graphs

      Activities for this week:

      • Familiarise yourself with how to start Jupyter Notebook:
      • Attend the Lectures on Tuesday
      • Do the Coursework and attend one of the IT labs

      Content for this week:

      • Lectures can be accessed here
      • Notes for this week are available here
      • Coursework download and submission for this week are available here
      • Set of additional exercises for practice: here
      • This week's quiz (available at the end of the week): here
      • This week's lab session walkthrough (available after the labs): here

      Optional:

      • See below for some help with AppsAnywhere
    • Week 2

      What's covered in this week?

      • defining and manipulating data variables. Sequences and Lists.
      • data libraries: numpy, math, matplotlib

      Activities for this week:

      • Attend the Lectures on Tuesday
      • Do the Coursework and attend one of the IT labs
      • Do the Quiz

      Content for this week:

      • Lectures can be accessed here
      • Notes for this week are available here
      • Coursework download and submission for this week are available here
      • Set of additional exercises for practice: here
      • This week's quiz (available at the end of the week): here
      • This week's lab session walkthrough (available after the labs): here
    • Week 3

      What's covered in this week?

      • More on sequences: slices, generators
      • Plotting
      • Built-in functions



      Content for this week:

      • Lectures can be accessed here
      • Notes for this week are available here
      • Coursework download and submission for this week are available here
      • Set of additional exercises for practice: here
      • This week's quiz (available at the end of the week): here
      • This week's lab session walkthrough (available after the labs): here
    • Week 4

      What's covered in this week?

      • User-defined functions
      • Functions as variables
      • Lambda functions

      Activities for this week:

      • Attend the Lectures on Tuesday
      • Do the Coursework and attend one of the IT labs
      • Do the Quiz
      • Please fill in this anonymous Early Feedback Questionnaire

      Content for this week:

      • Lectures can be accessed here
      • Notes for this week are available here
      • Coursework download and submission for this week are available here
      • Set of additional exercises for practice: here
      • This week's quiz (available at the end of the week): here
      • This week's lab session walkthrough (available after the labs): here

    • Week 5

      What's covered in this week?

      • Boolean Types
      • Boolean Operators
      • Conditional Statements (if)
      • recursive functions

      Activities for this week:

      • Attend the Lectures on Tuesday
      • Do the second in-term test on Wednesday
      • Do the Coursework and attend one of the IT labs
      • Do the Quiz

      Content for this week:

      • Lectures can be accessed here
      • Notes for this week are available here
      • Coursework download and submission for this week are available here
      • Set of additional exercises for practice: here
      • This week's quiz (available at the end of the week): here
      • This week's lab session walkthrough (available after the labs): here
    • Week 6

      What's covered in this week?

      • For loops
      • While loops
      • Application: evaluation of (infinite) sums
      • Infinite loops

      Activities for this week:

      • Attend the Lectures on Tuesday
      • Do the Coursework and attend one of the IT labs
      • Do the Quiz

      Content for this week:

      • Lectures can be accessed here
      • Notes for this week are available here
      • Coursework download and submission for this week are available here
      • Set of additional exercises for practice: here
      • This week's quiz (available at the end of the week): here
      • This week's lab session walkthrough (available after the labs): here
    • Week 7 - No Teaching

    • Week 8

      What's covered in this week?

      • Algorithms
        • Euclidean gcd algorithm
        • Arrangements of parentheses
        • Root finding via bisection

      Activities for this week:

      • Attend the Lectures on Tuesday
      • Do the third in-term test on Wednesday
      • Do the Coursework and attend one of the IT labs
      • Do the Quiz

      Content for this week:

      • Lectures can be accessed here
      • Notes for this week are available here
      • Coursework download and submission for this week are available here
      • This week's quiz (available at the end of the week): here
      • This week's lab session walkthrough (available after the labs): here

    • Week 9

      What's covered in this week?

      • Using GitHub
      • Copying Composite Data
      • Strings
      • File Input/Output

      Activities for this week:

      • Attend the Lectures on Tuesday
      • Do the Coursework and attend one of the IT labs
      • Do the Quiz

      Content for this week:

      • Lectures can be accessed here
      • Notes for this week are available here
      • Coursework download and submission for this week are available here
      • This week's quiz (available at the end of the week): here
      • This week's lab session walkthrough (available after the labs): here

    • Week 10

      What's covered in this week?

      • Array Operations with Numpy
      • Application: Solving Systems of Linear Equations
      • Data Analysis with Pandas: Example Atmospheric CO2

      Activities for this week:

      • Attend the Lectures on Tuesday
      • Do the fourth in-term test on Wednesday
      • Do the Coursework and attend one of the IT labs
      • Do the Quiz

      Content for this week:

      • Lectures can be accessed here
      • Notes for this week are available here
      • Coursework download and submission for this week are available here
      • This week's quiz (available at the end of the week): here
      • This week's lab session walkthrough (available after the labs): here

    • Week 11

      What's covered in this week?

      • More on Pandas
      • Application: Live Currency Exchange Data
      • Seaborn

      Activities for this week:

      • Attend the Lectures on Tuesday (with a presentation on CV writing, given by Sonia Lassami)
      • Do the Coursework and attend one of the IT labs
      • Do the Quiz

      Content for this week:

      • Lectures can be accessed here
      • Notes for this week are available here
      • Coursework download and submission for this week are available here
      • This week's quiz (available at the end of the week): here
      • This week's lab session walkthrough (available after the labs): here

    • Week 12

      What's covered in this week?

      • Python vs C - indentation and one statement per line vs using brackets and delimiters
      • inline if (or ternary conditional operator), and filtering using if in list comprehensions
      • unpacking and the * operator
      • Python function arguments: *args and all that
      • complexity analysis of algorithms

      Activities for this week:

      • Attend the Lectures on Tuesday
      • Do the fifth in-term test on Wednesday
      • Do the Coursework and attend one of the IT labs

      Content for this week:

      • Lectures can be accessed here
      • Notes for this week are available here
      • Coursework download (and optional submission) for this week are available here
      • This week's lab session walkthrough (available after the labs): here

    • Lecture notes and recordings

    • Labs

    • Lab Walkthroughs

    • Weekly Quizzes

    • Additional Exercises

      • Contains...

        Exercise 1: Mailing Address 
        Exercise 2: Hello 
        Exercise 3: Area of a Room 
        Exercise 4: Area of a Field 
        Exercise 5: Bottle Deposits 
        Exercise 6: Tax and Tip 
        Exercise 7: Sum of the First n  Positive Integers 
        Exercise 8: Widgets and Gizmos 
        Exercise 9: Compound Interest
        Exercise 10: Arithmetic
        Exercise 11: Fuel Efficiency 
        Exercise 12: Distance Between Two Points on Earth 
        Exercise 13: Making Change 
        Exercise 14: Height Units 
        Exercise 15: Distance Units 
        Exercise 16: Area and Volume
        Exercise 17: Heat Capacity 
        Exercise 18: Volume of a Cylinder
        Exercise 19: Free Fall
        Exercise 20: Ideal Gas Law
        Exercise 21: Area of a Triangle 
        Exercise 22: Area of a Triangle (Again) 
        Exercise 23: Area of a Regular Polygon 
        Exercise 24: Units of Time
        Exercise 25: Units of Time (Again) 
        Exercise 26: Current Time
        Exercise 27: Body Mass Index
        Exercise 28: Wind Chill 
        Exercise 29: Celsius to Fahrenheit and Kelvin 
        Exercise 30: Units of Pressure 
        Exercise 31: Sum of the Digits in an Integer
        Exercise 32: Sort 3 Integers 
        Exercise 33: Day Old Bread 


      • Contains...

        Exercise 34: Even or Odd? 
        Exercise 35: Dog Years
        Exercise 36: Vowel or Consonant
        Exercise 37: Name that Shape 
        Exercise 38: Month Name to Number of Days
        Exercise 39: Sound Levels 
        Exercise 40: Name that Triangle
        Exercise 41: Note To Frequency 
        Exercise 42: Frequency To Note 
        Exercise 43: Faces on Money 
        Exercise 44: Date to Holiday Name 
        Exercise 45: What Color is that Square? 
        Exercise 46: Season from Month and Day
        Exercise 47: Birth Date to Astrological Sign 
        Exercise 48: Chinese Zodiac 
        Exercise 49: Richter Scale 
        Exercise 50: Roots of a Quadratic Function 
        Exercise 51: Letter Grade to Grade Points 
        Exercise 52: Grade Points to Letter Grade 
        Exercise 53: Assessing Employees 
        Exercise 54: Wavelengths of Visible Light 
        Exercise 55: Frequency to Name 
        Exercise 56: Cell Phone Bill 
        Exercise 57: Is it a Leap Year? 
        Exercise 58: Next Day 
        Exercise 59: Is a License Plate Valid?
        Exercise 60: Roulette Payouts 


      • Contains...

        Exercise 61: Average 
        Exercise 62: Discount Table 
        Exercise 63: Temperature Conversion Table 
        Exercise 64: No More Pennies 
        Exercise 65: Compute the Perimeter of a Polygon 
        Exercise 66: Compute a Grade Point Average
        Exercise 67: Admission Price
        Exercise 68: Parity Bits
        Exercise 69: Approximate  
        Exercise 70: Caesar Cipher
        Exercise 71: Square Root
        Exercise 72: Is a String a Palindrome? 
        Exercise 73: Multiple Word Palindromes
        Exercise 74: Multiplication Table 
        Exercise 75: Greatest Common Divisor 
        Exercise 76: Prime Factors 
        Exercise 77: Binary to Decimal 
        Exercise 78: Decimal to Binary 
        Exercise 79: Maximum Integer 
        Exercise 80: Coin Flip Simulation 


      • Contains...

        Exercise 81: Compute the Hypotenuse 
        Exercise 82: Taxi Fare 
        Exercise 83: Shipping Calculator 
        Exercise 84: Median of Three Values 
        Exercise 85: Convert an Integer to its Ordinal Number 
        Exercise 86: The Twelve Days of Christmas 
        Exercise 87: Center a String in the Terminal 
        Exercise 88: Is it a Valid Triangle? 
        Exercise 89: Capitalize It 
        Exercise 90: Does a String Represent an Integer? 
        Exercise 91: Operator Precedence
        Exercise 92: Is a Number Prime?
        Exercise 93: Next Prime 
        Exercise 94: Random Password 
        Exercise 95: Random License Plate 
        Exercise 96: Check a Password 
        Exercise 97: Random Good Password
        Exercise 98: Hexadecimal and Decimal Digits 
        Exercise 99: Arbitrary Base Conversions
        Exercise 100: Days in a Month 
        Exercise 101: Reduce a Fraction to Lowest Terms 
        Exercise 102: Reduce Measures 
        Exercise 103: Magic Dates 


      • Contains...

        Exercise 104: Sorted Order
        Exercise 105: Reverse Order 
        Exercise 106: Remove Outliers
        Exercise 107: Avoiding Duplicates 
        Exercise 108: Negatives, Zeros and Positives 
        Exercise 109: List of Proper Divisors 
        Exercise 110: Perfect Numbers 
        Exercise 111: Only the Words 
        Exercise 112: Below and Above Average
        Exercise 113: Formatting a List 
        Exercise 114: Random Lottery Numbers 
        Exercise 115: Pig Latin 
        Exercise 116: Pig Latin Improved 
        Exercise 117: Line of Best Fit 
        Exercise 118: Shuffl ing a Deck of Cards
        Exercise 119: Dealing Hands of Cards 
        Exercise 120: Is a List already in Sorted Order?
        Exercise 121: Count the Elements 
        Exercise 122: Tokenizing a String 
        Exercise 123: Infix to Postfix
        Exercise 124: Evaluate Postfix 
        Exercise 125: Does a List contain a Sublist? 
        Exercise 126: Generate All Sublists of a List 
        Exercise 127: The Sieve of Eratosthenes 


    • Appsanywhere help