Ex2String
1. Write a Python program to get a string made of the first 2
and the last 2 chars from a given string.
Sample String : 'w3resource'
Expected Result : 'w3ce'
2. Write a Python program to get a string from a given
string where all occurrences of its first char have been
changed to '$', except the first char itself.
Sample String : 'restart', computer science
Expected Result : 'resta$t' computer s$ien$e
3. Write a Python program to get a single string from given two strings.
These are separated by space and swap the first two characters of each string.
Eg:
String 1 : computer
String 2: science
Result : scmputer coience
4. Write a Python program to get a single string from a given strings
with comma (,). Separate that string to be two string and
swap the first two characters of each string.
Sample String : 'abc,xyz'
Expected Result : 'xyc abz'
5. Write a Python program to remove the nth index character
from a nonempty string.
Enter a string: “Computer Science”
Enter the index number to remove character: 3
Output : Coputer Science