This content originally appeared on DEV Community and was authored by PERUMAL S
i have completed my task please let me know if found any mistake in comment box
Write a function that takes a string and returns a new string consisting of its first and last character.
number="tamizhnadu"
number[0:10:9]
Write a function that reverses a given string.
number[-1:-11:-1]
Given a string, extract and return a substring from the 3rd to the 8th character (inclusive).
num1="inclusive"
num1[2:9]
Write a function that returns every second character from a given string.
num1[2:9:2]
Write a function that checks if a given string is a palindrome (reads the same backward as forward).
name="civic"
print(name[0:4+1])
print(name[-1:-6:-1])
Given an email address, extract and return the domain.
mail="dummy@gmail.com"
mail[6:]
Write a function that returns every third character from a given string.
mail="dummy@gmail.com"
mail[2:15:3]
Write a function that extracts and returns characters at even indices from a given string.
mail[2:15:2]
Write a function that skips every second character and then reverses the resulting string.
mail[-1:-16:-2]
This content originally appeared on DEV Community and was authored by PERUMAL S
PERUMAL S | Sciencx (2024-07-22T17:44:22+00:00) day -7 task. Retrieved from https://www.scien.cx/2024/07/22/day-7-task/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.