Tasks - Indexing & Slicing
{% raw %}
- Write a function that takes a string and returns a new string consisting of its first and last character.
- Write a function that reverses a given string.
- Given a string, extract and return a substring from the 3rd to the 8th character (inclusive).
- Write a function that returns every second character from a given string.
- 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.
- Write a function that checks if a given string is a palindrome (reads the same backward as forward).
- Given an email address, extract and return the domain.
- Write a function that returns every third character from a given string.
- Write a function that extracts and returns characters at even indices from a given string.
- 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.