Files
freecodecamp--freecodecamp/curriculum/challenges/english/blocks/daily-coding-challenges-python/6a2037a68a0bc2aef0006007.md
T
wehub-resource-sync dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:55:53 +08:00

1.8 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
6a2037a68a0bc2aef0006007 Challenge 345: Word Blender 29 challenge-345

--description--

Given two words, return a new word by combining the first half of the first word with the second half of the second word.

  • For odd-length words, the first half is the shorter half.

--hints--

blend_words("turtle", "toucan") should return "turcan".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(blend_words("turtle", "toucan"), "turcan")`)
}})

blend_words("chipmunk", "flamingo") should return "chipingo".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(blend_words("chipmunk", "flamingo"), "chipingo")`)
}})

blend_words("falcon", "pelican") should return "falican".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(blend_words("falcon", "pelican"), "falican")`)
}})

blend_words("hyena", "iguana") should return "hyana".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(blend_words("hyena", "iguana"), "hyana")`)
}})

blend_words("scorpion", "gorilla") should return "scorilla".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(blend_words("scorpion", "gorilla"), "scorilla")`)
}})

blend_words("platypus", "wolverine") should return "platerine".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(blend_words("platypus", "wolverine"), "platerine")`)
}})

--seed--

--seed-contents--

def blend_words(word1, word2):

    return word1

--solutions--

def blend_words(word1, word2):
    first_half = word1[:len(word1) // 2]
    second_half = word2[len(word2) // 2:]
    return first_half + second_half