Professional Documents
Culture Documents
Exercise 1 - Datatypes
Exercise 1 - Datatypes
Write a Python program to get a string made of the first 2 and the last 2
chars from a given a string.
2. Write a Python program to get a single string from two given strings,
separated by a space and swap the first two characters of each string.
3. Write a Python program to find the first appearance of the substring 'not' and
'poor' from a given string.
7. Write a Python program to convert the first letter of each word in given
string to uppercase.
11. Write a Python program to print a specified list after removing the 0th, 4th
and 5th elements. Sample List : ['Red', 'Green', 'White', 'Black', 'Pink',
'Yellow'] Expected Output : ['Green', 'White', 'Black']
12. Write a Python program to get the difference between the two lists.
13. Write a Python program to replace the last element in a list with another
list.
14. Write a Python program to check if all items of a list is equal to a given
string.
19. Write a python program to find the union and intersection of 2 sets.
20. Write a python program to find the elements in s1 that are not in s2.
22. Write a python program to add all elements from another set to an existing
set.