Skip to content

Course home

String handling operations in a programming language

String handling operations in a programming language

EasyMedium
1234567891011121314151617181920
Question 11

A marine biologist wants to create unique tracking tags for marine mammal sightings during research expeditions.

Table 1 shows some of the recorded sightings.

Table 1

sightingIDspecieslocation
S109BLUE WHALEPACIFIC
S214ORCAATLANTIC
S305HUMPBACKINDIAN

A tracking tag is made up of the:

  • sightingID
  • last character of the species name
  • first three characters of the location

For example:

  • the tracking tag for the BLUE WHALE sighting in the PACIFIC would be S109EPAC
  • the tracking tag for the ORCA sighting in the ATLANTIC would be S214AATL

Write a Python program to generate the tracking tag for a sighting.

The program should:

  • get the user to enter the sightingID, species and location
  • create the tracking tag
  • assign the tracking tag to a variable called trackingTag

You should use indentation as appropriate, meaningful variable name(s), and valid Python syntax in your answer.

[4]
Markscheme

String handling operations in a programming language Questions

  1. GCSE
  2. /Computer Science
  3. /String handling operations in a programming language

89 exam-style questions on AQA GCSE Computer Science String handling operations in a programming language. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank