{"id":18715,"date":"2021-08-26T10:38:04","date_gmt":"2021-08-26T05:08:04","guid":{"rendered":"https:\/\/python-programs.com\/?p=18715"},"modified":"2021-11-22T18:37:18","modified_gmt":"2021-11-22T13:07:18","slug":"python-program-for-snake-case-of-a-given-sentence","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-for-snake-case-of-a-given-sentence\/","title":{"rendered":"Python Program for Snake Case of a Given Sentence"},"content":{"rendered":"

In the previous article, we have discussed Python Program to Check Trimorphic Number or Not<\/a>
\nThe task is to remove spaces from a sentence and rewrite it in the Snake case. It is a writing style in which spaces are replaced with underscores and all words begin with small letters.<\/p>\n

\u00a0The lower() method in Python:<\/strong><\/p>\n

lower() returns a string with all characters in lower case.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given string\/sentence = Hello this is Btechgeeks<\/pre>\n

Output:<\/strong><\/p>\n

The given sentence { Hello this is Btechgeeks } after Converting into Snake case :\r\nhello_this_is_btechgeeks<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given string\/sentence = Good morning This is Btechgeeks<\/pre>\n

Output:<\/strong><\/p>\n

The given sentence { Good morning This is Btechgeeks } after Converting into Snake case :\r\ngood_morning_this_is_btechgeeks<\/pre>\n

Program for Snake Case of a Given Sentence in Python<\/h2>\n

Below are the ways to remove spaces from a sentence and rewrite it in the Snake case:<\/p>\n