{"id":8536,"date":"2021-08-20T19:50:21","date_gmt":"2021-08-20T16:50:21","guid":{"rendered":"https:\/\/elzero.org\/?p=8536"},"modified":"2022-08-07T06:47:40","modified_gmt":"2022-08-07T03:47:40","slug":"python-problems-solving-find-longest-word-in-string","status":"publish","type":"post","link":"https:\/\/elzero.org\/old\/python-problems-solving-find-longest-word-in-string\/","title":{"rendered":"Find Longest Word In a String"},"content":{"rendered":"<h3>\u0627\u0644\u062d\u0644 \u0627\u0644\u0645\u0648\u062c\u0648\u062f \u0641\u064a \u0627\u0644\u0641\u064a\u062f\u064a\u0648<\/h3>\r\n\r\n<script type=\"text\/plain\" class=\"language-python\">\r\n# First Solution\r\ndef longest_word_in(sentence):\r\n  count = 0\r\n  words_list = sentence.split(\" \")\r\n  for word in words_list:\r\n    if len(word) > count:\r\n      count = len(word)\r\n      longest = word\r\n  return longest\r\n\r\n# Shorten The Solution\r\ndef longest_word_in(sentence):\r\n  longest = \"\"\r\n  words_list = sentence.split(\" \")\r\n  for word in words_list:\r\n    if len(word) > len(longest):\r\n      longest = word\r\n  return longest\r\n\r\n# Testing Ouput\r\nprint(longest_word_in(\"In Programming We Love Elzero Academy Tooooooooooo Much\")) # Tooooooooooo\r\n<\/script>","protected":false},"excerpt":{"rendered":"<p>Find Longest Word In a String With Python<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1337],"tags":[],"class_list":["post-8536","post","type-post","status-publish","format-standard","hentry","category-problems-solving"],"_links":{"self":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/8536","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/comments?post=8536"}],"version-history":[{"count":2,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/8536\/revisions"}],"predecessor-version":[{"id":8630,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/8536\/revisions\/8630"}],"wp:attachment":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/media?parent=8536"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/categories?post=8536"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/tags?post=8536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}