Solution Exercise 208: remove an element from a given python set
Exercise 208 Write a program in Python that remove an element from a given set A without using the discard() or remove() methods. Solution # define a set AA =…
Solution Exercise 207: add an element to a python set
Exercise 207 Given a set A = { 'a', 'b', 'c', 'd' }. Write an algorithm in Python that adds an element 'x' to A without using the add() method.…
Solution Exercise 206: Symetric difference of two sets in python
Exercise206 Given two sets A = {'a' , 'b' , 'c' , 'd'} and B = {'c' , 'e' , 'd' , 'h'}. Write a Python program that returns their…
The Python string find() method
1. Description of the Python find() method The Python find() method applied to a character string returns the smallest index of the substring if it is in this string. If…
The Python expandtabs() string method
1. Description of the expandtabs() method The expandtabs() method returns a copy of the string with all tab characters 't' replaced by space characters a number of times equal to…
The Python String endswith() method
1. Description of endswith() method The Python string endswith() method returns True if the string ends with the specified suffix, otherwise returns False, optionally restricting matching with the given start…
encode() and decode() methods in python
1. The Python encode() method The Python string encode() method is used to encode the string using the provided encoding. This function returns the bytes object. If we don't provide…