Longest even length word hackerrank solution python
Answers
Answered by
0
Answer:
Input: s = "This is a python language"
Output: This
is
python
language
Input: s = "i am muskan"
Output: am
muskan
Explanation:
please mark me down as a BRAINLIEST for more answers please follow me.
Answered by
0
Longest even length word hackerrank solution is:
- Approach used here is, split() function is used to split the string. Iterate in the words of string using loop.
- Calculate the length of the word using len() function. If the length is even the print the word.
def printWords(s):
s=s.split(' ')
for word in s:
if len(word)%2==0:
print(word)
- Input:"This is a python language"
- output:
This
is
python
language.
Similar questions