Logic101

Problem Sets

NAMASTE+

Beginner PSET 0 — Problem 2
Humans are flexible with language. Computers are not.

India has 22 officially recognized languages and over 19,500 dialects. A single country — smaller in area than the United States — contains more linguistic diversity than all of Europe combined.

Walk east from Gujarat and you'll hear Gujarati. Cross the border into Maharashtra and it becomes Marathi. Keep walking through Karnataka, Kerala, Tamil Nadu, Andhra Pradesh, West Bengal, Punjab — each state, each region, each community has its own way of saying the same thing: I acknowledge you. I see you. You are welcome here.

Language / RegionGreeting
Hindi / SanskritNamaste
BengaliNomoshkar
TamilVanakkam
PunjabiSat Sri Akal
GujaratiKem Cho
KannadaNamaskara
MalayalamNamaskaram
OdiaNamaskar
TeluguNamaskaram
AssameseNamaskar

These aren't just different words for the same idea. Each greeting carries the weight of its culture. Vanakkam in Tamil isn't just "hello" — it comes from the root word meaning "respect" or "reverence." Sat Sri Akal in Punjabi translates to "Truth is the Eternal One" — it's a theological statement disguised as a greeting. Nomoshkar in Bengali carries the same Sanskrit root as Namaste, but through centuries of Bengali pronunciation, the sound itself has shifted, the way a river slowly carves a new path through stone.

Real-world software rarely receives perfectly formatted input. A user might type:

tamil

or:

TAMIL

or even:

   TaMiL

Every single one of these is the same word. But to a computer, they're completely different strings. "TAMIL" == "tamil" is False. This is not a bug — it's a fundamental truth about how computers process information. They are precise. They don't assume. They don't interpret. They do exactly what you tell them, nothing more.

The programs that feel "smart" — Google search, autocorrect, voice assistants — are all built on top of this reality. They work because someone, at some point, wrote code that says: "Before you do anything else, clean the input. Strip the spaces. Convert everything to the same case. Then decide what to do with it."

This is not just a programming technique. It's a way of thinking: normalize first, then process. It applies to data, to communication, to arguments, to relationships. Before you react to what someone said, make sure you understood what they meant.

Specification

In a file called namasteplus.py, implement a program that asks the user for:

  • their name
  • their preferred language or region

and then greets them appropriately.

For example:

What is your name? Ravi
Preferred language: Tamil
Vanakkam, Ravi
What is your name? Ananya
Preferred language: Bengali
Nomoshkar, Ananya

Your program should behave correctly regardless of capitalization or accidental spaces. If the user enters a language not in the table, your program should fall back to Namaste.

Useful String Methods

MethodExampleResult
.lower()"HELLO".lower()"hello"
.upper()"hello".upper()"HELLO"
.capitalize()"tanishka".capitalize()"Tanishka"
.title()"logic 101".title()"Logic 101"
.strip()" hello ".strip()"hello"

Hints

Normalization Pattern

You don't need all of these methods. Read the problem carefully, think about what could go wrong with user input, and choose the right tool. The pattern language.strip().lower() removes extra spaces and converts to lowercase in one step — making your comparisons reliable regardless of how the user types.

Start Coding

Open your Codespace and create namasteplus.py.

Open Codespace
l101 test namasteplus.py