zip, 157.44 KB
zip, 157.44 KB

Python Resource Pack 3 is a set of coding challenges designed to support the teaching and learning of the Python programming language.

This pack is designed for those who have some experience of programming in Python, such as completing the exercises in Resource Packs 1 and 2. It is suitable for teaching Python in schools from Year 8 onwards, tutors and learners in adult learning classes or for the hobbyist learning at home.

The pack also encourages the learner to start to consider the whole system life cycle and program documentation by introducing the following requirements:

  • Preparatory design before attempting to code the solution to the challenge.
  • Full validation to prevent the wrong type of data or incorrect values from being entered.
  • Full testing (both unsuccessful and successful tests, together with any corrective actions) to be recorded as a part of the solution alongside the code.

The pack is designed to support learning that has previously taken place in the classroom, via self-directed study, or by following tutorials.

The pack contains:

  • A pdf file with four coding challenges.
  • Fully commented example solutions to each of the challenges.

The following topics are introduced:

  • The regular expression module.
  • The re.match command to determine if a string matches a format defined by a regular expression.
  • .isspace() to detect strings made completely of spaces.
  • The len command to find the length of a string.
  • The lstrip() and rstrip() commands to remove spaces, newline and tab characters from the start and end of a string.
  • Parameter passing to procedures/functions.
  • The random.seed command to seed the random number generator.
  • The random.randrange to set the range of random numbers to be generated.
  • The try… except ValueError command for error trapping.
  • Lists.
  • The sum command to add the values in a list of numbers.
  • The statistics module.
  • The chr command to get a character from an ASCII value.
  • The count() command to determine how many times one string appears in another.

The challenges are designed so that self-directed research will be required to complete them; they are not a cut-and-paste tutorial.

The challenges:

  • Input a message from a restricted character set and display it capitalised as an on-screen banner.
  • Implement a version of the board game ‘Mastermind’.
  • User chooses how many numbers are to be input. Enter that number of non-negative integers and calculate the sum, mean, mode and median.
  • Enter a putative email address and tell the user if it is valid; otherwise explain all the reasons why it is invalid.

Get this resource as part of a bundle and save up to 20%

A bundle is a package of resources grouped together to teach a particular topic, or a series of lessons, in one place.

Reviews

Something went wrong, please try again later.

This resource hasn't been reviewed yet

To ensure quality for our reviews, only customers who have purchased this resource can review it

Report this resourceto let us know if it violates our terms and conditions.
Our customer service team will review your report and will be in touch.