PYTHON LESSON 5 OF 32

Friendly strings

Strings are text. Join them with +, count characters with len(), and use f-strings to insert values. String methods return new strings: upper() does not change the original value.

हिन्दी में समझें

स्ट्रिंग टेक्स्ट है। + से जोड़ें, len() से अक्षर गिनें और f-string से मान डालें। upper() नया टेक्स्ट लौटाता है; पुराना मान नहीं बदलता।

अभ्यास: name को छोटे अक्षरों में प्रिंट करने की पंक्ति जोड़ें।

Hinglish mein samjhein

String matlab text. + se jodo, len() se characters gino aur f-string mein variable lagao. upper() nayi string deta hai, original nahi badalta.

Practice: name ko lowercase mein print karne wali line jodo.

A small Python example

name = "Asha"
print(f"Hello, {name}!")
print(name.upper())

The browser playground runs real Python with Pyodide. Use sample variables instead of interactive input(). Browser package support differs from desktop Python.

Try this example in the Python playground →

Practise this idea

Add a line that prints name in lowercase.

Check answer & explanation
name = "Asha"
print(f"Hello, {name}!")
print(name.upper())
print(name.lower())

lower() returns a new lowercase string. Printing that result displays asha without changing the original name.

Stuck in the course? Choose Check answer for either the challenge or quiz. Read the explanation and continue to the next lesson at your own pace.

Check your understanding

How do you count characters?

  1. len(name)
  2. name.count_all()
  3. size name
Check the quiz answer

len(name)

len() returns the number of items, including characters in a string.

References & corrections

Use the official Python documentation for full language rules. Read how these lessons are made and checked. Found a mistake? Report it to Excel Keys with this lesson URL and a reproducible example.

FROM LEARNING TO BUSINESS RESULTS

Need a dashboard for your team?

Excel Keys designs custom Excel and HTML dashboards around your own KPIs and Excel files. They run offline in the browser, so your data stays on your computer.