Python Strings · Question 3 · Easy

Two case-changing methods are called on string literals. What is the output?

print("chai".upper(), "PUNE".lower())
  1. CHAI pune
  2. Chai pune
  3. CHAI Pune
  4. chai PUNE
Answer and explanation

Answer: A. CHAI pune

Explanation: upper() returns a copy with every letter in capitals and lower() returns a copy with every letter in small case. So the output is CHAI pune.

Previous: The length of a string is used to reach its last character. What is printed? · Next: Which string method removes whitespace from both ends of a string?

Practise python strings

Try a fresh set of python strings questions with an explanation after every answer, free and without signing up: Python Strings practice. Or sit a full placement mock test.

More python strings questions

More python practice

Lists & Tuples · Dictionaries & Sets · Conditions & Loops · Functions & Scope · Comprehensions & Generators · Classes & Objects · Exceptions & Files · Built-ins & Standard Library

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge