Library › Data AI › Operations and supply chain
Convert messy country names into ISO codes in a CSV block
- For Operations and supply chain
- You practice Showing an example of what you want
- Time about 5 minutes
- Level Intermediate
About this exercise
Your customer export has country names typed many ways and the billing tool needs two-letter ISO codes. Write one CSV block (one code block) with the header original,iso2 and one row per value in the same order. Use the official ISO code (the United Kingdom is GB, not UK), and write UNKNOWN for anything that isn't a real country. At most 12 words outside the code.
Common mistakes when you ask AI for this
- Writing UK. UK is common but not an ISO code, so the billing tool rejects it. Try: Add: "The United Kingdom is GB, not UK."
- Inventing a code. The AI gives Atlantis a made-up code. Try: Add: "If it isn't a real country, write UNKNOWN."
- Wrong CSV shape. The AI drops the header or reorders rows. Try: Add: "Header original,iso2, then 8 rows in the same order."
- Leaving the format to chance. The AI picks its own length and layout unless told the exact shape. Try: Add: "Put the code in exactly 1 code block. Keep the writing outside the code under 12 words."
What a strong prompt includes
- Names ISO codes
- Fixes UK
- Says what to do with fakes
- Names the header
- Keeps the order
Related exercises
- Add a cron line that matches the others in a crontab (Coding AI · Product managers)
- Add mail-merge greetings for couples and missing names (Coding AI · Nonprofit staff)
- Annualize recurring revenue without the one-time fee (Data AI · Finance and accounting)
- Answer a new analyst's table questions using only the data guide (Data AI · Business analysts)
- Answer a revenue terms FAQ for new hires using one deal (Data AI · Finance and accounting)