Maratona de fragmentos de strings
Este desafio tem cinco exercícios curtos para ajudar você a praticar a habilidade de extrair fragmentos de strings. Confira os exemplos abaixo para ver visualmente como extrair fragmentos das strings. Boa sorte!
Exemplos
txt = "abcdefghijklmnopqrstuvwxyz"challenge1(txt) ➞ "abcde"
# First 5 characters of the string.
challenge2(txt) ➞ "vwxyz"
# Last 5 characters of the string.
challenge3(txt) ➞ "zyxwvutsrqponmlkjihgfedcba"
# All characters in the string from back.
challenge4(txt) ➞ "fedcba"
# First 6 characters in the string (start with 6th character and go backwards).
challenge5(txt) ➞ "tvxz"
# From the final seven characters, return every other character, starting with the first of those seven.Observações
- Confira a aba Tests para ver mais exemplos.
- Consulte a aba Resources para obter mais informações sobre como aprender a extrair fragmentos de strings.
- Você não pode concatenar strings! Os resultados devem ser obtidos exclusivamente por meio da extração de fragmentos de strings.