{"id":24778,"date":"2021-11-02T09:46:29","date_gmt":"2021-11-02T04:16:29","guid":{"rendered":"https:\/\/python-programs.com\/?p=24778"},"modified":"2021-11-05T19:16:56","modified_gmt":"2021-11-05T13:46:56","slug":"python-string-lower-method-with-examples","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-string-lower-method-with-examples\/","title":{"rendered":"Python String lower() Method with Examples"},"content":{"rendered":"
In the previous article, we have discussed Python String index() Method with Examples<\/a> lower() returns a string with all characters in lower case.<\/p>\n Symbols and numbers are not accepted.<\/p>\n Syntax:\u00a0<\/strong><\/p>\n Parameter Values:<\/strong> This method has no parameters.<\/p>\n Return Value:<\/strong><\/p>\n lower() returns the lowercase string from a given string. It converts all uppercase to lowercase characters.<\/p>\n If no uppercase characters are found, the original string is returned.<\/p>\n Examples:<\/strong><\/p>\n Example1:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:<\/strong><\/p>\n Example2:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:<\/strong><\/p>\n Approach:<\/strong><\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n Approach:<\/strong><\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n Approach:<\/strong><\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n Go through our tutorial and learn about various Python String Method Examples<\/a> and learn how to apply the knowledge while dealing with strings.<\/p>\n In the previous article, we have discussed Python String index() Method with Examples String lower() Method in Python: lower() returns a string with all characters in lower case. Symbols and numbers are not accepted. Syntax:\u00a0 string.lower() Parameter Values: This method has no parameters. Return Value: lower() returns the lowercase string from a given string. It …<\/p>\n
\nString lower() Method in Python:<\/strong><\/p>\nstring.lower()<\/pre>\n
Given String = \"HELLO this IS Btechgeeks\"<\/pre>\n
The given original string : HELLO this IS Btechgeeks\r\nThe given string after applying lower() method :\r\nhello this is btechgeeks<\/pre>\n
Given String = \"GooD MORNING btechgeeks@123$$#\"<\/pre>\n
The given original string : GooD MORNING btechgeeks@123$$#\r\nThe given string after applying lower() method :\r\ngood morning btechgeeks@123$$#<\/pre>\n
String lower() Method with Examples in Python<\/h2>\n
\n
Method #1: Using Built-in Functions (Static Input)<\/h3>\n
\n
# Give the string as static input and store it in a variable.\r\ngvn_str = \"HELLO this IS Btechgeeks\"\r\n# Apply lower() method to the given string that returns a string with all characters\r\n# in lower case.\r\n# Store it in another variable.\r\nrslt = gvn_str.lower()\r\n# Print the given original string.\r\nprint(\"The given original string :\", gvn_str)\r\n# Print the given string after applying the lower() method.\r\nprint(\"The given string after applying lower() method :\")\r\nprint(rslt)\r\n<\/pre>\n
The given original string : HELLO this IS Btechgeeks\r\nThe given string after applying lower() method :\r\nhello this is btechgeeks<\/pre>\n
How does lower() function work in a program?<\/h3>\n
\n
# Give the first string as static input and store it in a variable.\r\ngvn_fststr = \"WELCOME to PythoN PROGRAMS\"\r\n# Give the second string as static input and store it in a variable.\r\ngvn_scndstr = \"Welcome to Python programs\"\r\n# Converting both the first and second strings into lowercase using the lower()\r\n# method and checking if both the strings are same or not using the if conditional\r\n# statement.\r\nif(gvn_fststr.lower() == gvn_scndstr.lower()):\r\n # If it is true, then print \"The given first and second strings are same\".\r\n print(\"The given first and second strings are same\")\r\nelse:\r\n # Else print \"The given first and second strings are NOT same\".\r\n print(\"The given first and second strings are NOT same\")\r\n<\/pre>\n
The given first and second strings are same<\/pre>\n
Method #2: Using Built-in Functions (User Input)<\/h3>\n
\n
# Give the string as user input using the input() function and store it in a variable.\r\ngvn_str = input(\"Enter some Random String = \")\r\n# Apply lower() method to the given string that returns a string with all characters\r\n# in lower case.\r\n# Store it in another variable.\r\nrslt = gvn_str.lower()\r\n# Print the given original string.\r\nprint(\"The given original string :\", gvn_str)\r\n# Print the given string after applying the lower() method.\r\nprint(\"The given string after applying lower() method :\")\r\nprint(rslt)\r\n<\/pre>\n
Enter some Random String = GooD MORNING btechgeeks@123$$#\r\nThe given original string : GooD MORNING btechgeeks@123$$#\r\nThe given string after applying lower() method :\r\ngood morning btechgeeks@123$$#<\/pre>\n
\n