accept string from user and display even index of that string
Answers
Answered by
3
Answer:
Method 1: Using string slicing Above program reads a string as input and creates a new string with characters at index which are multiples of 2. Expression str[::2] fetches all characters in a string which have an index difference equal to the value supplied at the right starting from the value at the left.
Similar questions
Math,
1 month ago
Math,
1 month ago
English,
1 month ago
Computer Science,
3 months ago
Hindi,
3 months ago
Geography,
10 months ago
CBSE BOARD X,
10 months ago
English,
10 months ago