Time limit: 1 hour
Chapters covered: 1 – Basics, 2 – Variables & Operators, 3 – Strings
Difficulty: Beginner‑friendly & fun
Goal: Produce a console program that asks the user for information and prints a formatted Secret Agent ID Card.
Design a Python script that, after collecting a few details from the user, displays a hacker‑style ID card for a secret agent.
The card must show the real name, a masked code name, joining year, mission status, and a custom ID string.
# | Requirement | Chapter Concept |
---|---|---|
1 | Display a welcome message using print() |
Chapter 1 |
2 | Collect four inputs: real name, secret code name, joining year, mission status | Chapter 2 – input() & type casting |
3 | Mask the code name by showing only its first three characters followed by five asterisksmasked = code[:3] + "*****" |
Chapter 3 – slicing |
4 | Convert the mission status to UPPER‑CASE before printing | Chapter 3 – string methods |
5 | Create an ID string by concatenating the uppercase code name with the last two digits of the year, separated by a dashID = CODE.upper() + "-" + year[-2:] |
Ch 2 (operators) & Ch 3 (slicing, methods) |
6 | Use an f‑string and escape sequences (\\n , etc.) to print the final card exactly like the sample below |
Chapter 3 – f‑strings & escapes |
7 | Program must run without errors and produce the correct format | All |
random
module and attach AGT‑XXXX
to the ID card.pyttsx3
to announce: "ID Generated. Welcome, Agent ___."SPY2025
) and validate with logical operators before proceeding.*** Welcome to Spy ID Generator ***
Enter your real name: Prathamesh Nalge
Enter your secret code name: Phantom28
Enter your joining year: 2025
Enter your mission status (Success/Failure): Success
Generating ID...
==============================
|| SECRET AGENT ID CARD ||
==============================
|| Name : Prathamesh Nalge
|| Code Name : Pha*****
|| Joined : 2025
|| Status : SUCCESS
|| ID String : PHANTOM28-25
==============================
(Your output must replicate this layout, but with whatever data the user types.)
code[:3]
gives chars 0, 1, 2.status.upper()
converts the entire string.