Post

Tasks - Indexing & Slicing

{% raw %}

  1. Write a function that takes a string and returns a new string consisting of its first and last character.
  2. Write a function that reverses a given string.
  3. Given a string, extract and return a substring from the 3rd to the 8th character (inclusive).
  4. Write a function that returns every second character from a given string.
  5. Write a function that replaces the middle third of a string with asterisks. If the length of the string is not divisible by 3, adjust the middle third accordingly.
  6. Write a function that checks if a given string is a palindrome (reads the same backward as forward).
  7. Given an email address, extract and return the domain.
  8. Write a function that returns every third character from a given string.
  9. Write a function that extracts and returns characters at even indices from a given string.
  10. Write a function that skips every second character and then reverses the resulting string.

{% endraw %}

This post is licensed under CC BY 4.0 by the author.