As a new recruit at the LabEx Space Academy, you have been tasked with creating a simple program to process astronaut name tags. This challenge will test your ability to manipulate strings in Python, a crucial skill for handling text data in various space mission scenarios.
This is a Challenge, which differs from a Guided Lab in that you need to try to complete the challenge task independently, rather than following the steps of a lab to learn. Challenges are usually a bit difficult. If you find it difficult, you can discuss with Labby or check the solution. Historical data shows that this is a beginner level challenge with a 92% pass rate. It has received a 98% positive review rate from learners.
Astronaut Name Tag Processor
In this step, you will create a Python script that processes an astronaut's name to create a standardized name tag.
Tasks
Create a Python script named name_tag_processor.py in the /home/labex/project directory. (Recommend to use WebIDE)
Use the input() function to prompt the user to enter an astronaut's full name.
Process the entered name to create a standardized name tag by performing the following operations:
Convert the full name to uppercase using the upper() method
Replace any spaces with underscores using the replace() method
Add the prefix "ASTRONAUT_" to the beginning of the processed name.
Print the original name and the processed name tag.
String Methods Reference
upper()
The upper() method converts all characters in a string to uppercase:
In this challenge, you have created a Python script to process astronaut name tags. This exercise has reinforced your understanding of string manipulation in Python, including methods like upper() and replace(). You have also practiced using the input() function to get user input and formatting output strings. These skills are fundamental in Python programming and will be valuable in more complex data processing tasks you may encounter in your space academy training.