How to Make a String Uppercase Using Python

Python was developed as an object-oriented programming language for desktop and web development. One of the reasons hat Python has become so well-liked and used is that many built-in functions exist in Python toperform repetitive or interesting tasks, and they require little in the way of coding to accomplish. Therefore, many Python programs are less verbose and easier to read than programs in other languages. As an example, performing string operations to change the case of a string only involves invoking a few built-in functions.

Things You'll Need

  • Python Interpreter
Show More

Instructions

    • 1

      Declare a string variable containing any string of any size:

      >>>s = 'This is an example string'

    • 2

      Use the "upper()" function to change all letters to uppercase (Source 1):

      >>>s = s.upper()
      >>>s
      'THIS IS AN EXAMPLE STRING'

    • 3

      Use the "lower()" function to change all the letter to a lowercase setting:

      >>>s = s.lower()
      >>>s
      'this is an example string'

Related Searches:

References

Comments

Related Ads

Featured