← Questions

Passport number form with per-country formats

0
StripeCodingLast asked Aug 2025

You get a map from country to passport number format, for example {USA: "LLDDDD", Canada: "AALLDDDD"}, where L must be a letter, D a digit and A either one.

  1. Build the layout: a country selector filled from the map, a passport number input and a Validate button.
  2. Write a function that takes a country and a passport number and says whether the number matches that country's format, then connect it to the form.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding