Founding Batch Offer ยท HLD ยท LLD ยท System Design at โ‚น799 until 30 Nov

Convert to Lowercase

Convert text to lowercase with Python lower. Students trace the returned string, unchanged digits, and why changing case does not validate or clean text.

BeginnerPhase 5 - Category 1: Basic String HandlingExample 4 of 10
convert-to-lowercase.py
1# Take string input
2s = input("Enter a string: ")
3
4# Convert to lowercase
5lower_str = s.lower()
6print(f"Lowercase: {lower_str}")

Output

Enter a string: HELLO
Lowercase: hello

In this one

  • Normalize lowercase text
  • Retain nonletters
  • Separate conversion from validation

How it works

  1. 1

    Read the response as text.

  2. 2

    Call s.lower() and save the result.

  3. 3

    Print lower_str.

Edge cases

What does empty input produce?

What does empty input produce?

An empty lowercase result.

Are spaces removed?

Are spaces removed?

No. Their positions stay present.

What's going on

lower returns a new string with lowercase mappings. The result is stored separately from s before printing.

For HELLO 2, the output text is hello 2. Numbers and ordinary punctuation are not removed. Lowercasing can help normalize English comparisons, but does not validate words or remove accents; Unicode case handling can require more care for broader matching tasks.

What does empty input produce? An empty lowercase result.

Are spaces removed? No. Their positions stay present.

Quiz

Tap an option. The answer stays hidden until you pick.

Question 1

Does lower alter the source string?

Pick an answer to check it.

Question 2

What does empty input produce?

Pick an answer to check it.

Questions people ask

What does empty input produce?

An empty lowercase result.

Are spaces removed?

No. Their positions stay present.

Does lower alter the source string?

No.