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
Computer Science,
3 hours ago
Science,
3 hours ago
Computer Science,
5 hours ago
Hindi,
5 hours ago
CBSE BOARD X,
7 months ago
English,
7 months ago