Question 4: Variable Student ID

🎓 Student ID

import task_variables_04

A school uses the first letter of each student’s first and last name as an ID. Amara Okafor’s ID would be “A.O.”.

Write a Python program to build Amara’s ID step by step.

  • Store the first name in a variable called first_name and set it to “Amara”.
  • Store the last name in a variable called last_name and set it to “Okafor”.
  • Get the first letter of first_name using first_name[0] and store it in a variable called first_letter.
  • Get the first letter of last_name using last_name[0] and store it in a variable called last_letter.
  • Combine them as “X.Y” (first letter, a dot and the last letter) using the + operator, and store it in a variable called name_initials.
  • Print name_initials.

💡 Hint: You can use + to glue (concatenate) strings together. For example: first_letter + “.” + last_letter. Do not use f-strings.

Write what you are looking for, and press enter to begin your search!