
Learning Objectives
In this post we will focus on string manipulation techniques using five common techniques used in most procedural programming languages:
- LEFT: to extract characters at the beginning of a string,
- RIGHT: to extract characters at the end of a string,
- LENGTH: to find out the number of characters in a string,
- MID: to extract a set number of characters at a given position in a string,
- LOCATE: to find if a substring is included in another string and if so return the position of this substring in the string.
>>> to extract the first 5 characters of a string.
>>> to extract the last 5 characters of a string.
>>> to retrieve the number of characters in a string.
>>> to extract a set number of characters at a given position in a string.
>>> to find if a substring is included in another string and if so return the position of this substring in the string.
If the substring is not part of the string, the value -1 is returned.
Your Challenge
Check the code below which is based on the 5 string manipulation functions we mentioned above: Left, Right, Length, Mid, and Locate.
Your challenge is to tweak this code to ask the user to enter their school username in the following format:
- Year Group Using two digits (e.g. “07” for year 7, “11” for year 11, “00” for staff members)
- 1 character for their initial (first letter of their firstname)
- The user’s lastname
- A 2-digit code: “_S” for students, “_T” for teachers, “_A” for admin staff.
For instance the following usernames are valid usernames:
07jFox_S
09kJohnson_S
11rTaylor_S
00pJones_T
00jOliver_A
Your program should read the username and decide:
- If the username is less than 6 characters long the program should ask the user to enter a valid username.
- If the username does not contain the character “_” it should also ask the user to enter a valid username.
- If the username is valid, the program should decide if the user is a member of staff or a student.
- If they are a student the programme should find out their year group.
- The program should also display the initial of the student as well as their lastame.
- Finally the program should display whether the user is a Student, a Teacher or an Admin member of staff.

Have you got any idea how old you will be in 2050?
When designing electronic circuits you may need to use resistors. Each resistor has a resistance value expressed in ohms (Ω). Resistors are identified by a series of concentric coloured bands. Each band colour has a value which is used to calculate the resistance value of the resistor.



Meet E.V.E., a computer algorithm with artificial intelligence. E.V.E. can communicate with human beings. Well it’s only a start and we need you to complete the code provided below for E.V.E to be able to communicate more effectively with teenagers.






In this challenge we are looking at how a list can be used to store all the players’ names of a football team.



In this challenge we are going to write a Python program that automatically generates six random numbers (from 1 to 50) and display them on the screen, sorted in ascending order.

