DEV Community

PERUMAL S
PERUMAL S

Posted on

day -7 task

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]

Top comments (0)