Hartismere School

Est. 1451. An outstanding coeducational secondary school & sixth form college and England's first academy

Coronavirus (COVID-19)

GCSE CS: Hartismere usernames program

Hartismere Usernames

Mr Waller is creating usernames for new students. The rule is that the username is the surname, followed by the first name with no spaces and in lowercase.

Create some code that asks for the first name and surname, creates the username, adds it to the list of usernames and then prints out all of the usernames entered.

For this, you will have to:

  • Create a blank list (e.g. usernames = [] )
  • Ask the user to input the first name
  • Ask the user to input the surname
  • Concatenate them together following the rules for usernames
  • Append the new username to the list
  • Prints out the list

Extension for when you have completed the basic program

  1. Make the program loop so that usernames can be added to the list forever, until ‘exit’ is entered
  2. Make it so when the usernames are printed, they are printed one after the other using a loop
  3. A new rule has been put in place: usernames now have the person’s age at the end. Add the appropriate code.
  4. The rule has changed again. The username is now the surname, first 2 letters of the first name and then the age. The user still has to enter the full first name though and the code has to pick out the first 2 characters.