PYTHON Interview Questions and Answers
Question - 41 : - How will you convert a String to an object in python?
Answer - 41 : - eval(str) − Evaluates a string and returns an object.
Question - 42 : - How will you convert a string to a tuple in python?
Answer - 42 : - tuple(s) − Converts s to a tuple.
Question - 43 : - How will you convert a string to a list in python?
Answer - 43 : - list(s) − Converts s to a list.
Question - 44 : - How will you convert a string to a set in python?
Answer - 44 : - set(s) − Converts s to a set.
Question - 45 : - How will you create a dictionary using tuples in python?
Answer - 45 : - dict(d) − Creates a dictionary. d must be a sequence of (key,value) tuples.
Question - 46 : - How will you convert a string to a frozen set in python?
Answer - 46 : - frozenset(s) − Converts s to a frozen set.
Question - 47 : - How will you convert an integer to a character in python?
Answer - 47 : - chr(x) − Converts an integer to a character.
Question - 48 : - How will you convert an integer to an unicode character in python?
Answer - 48 : - unichr(x) − Converts an integer to a Unicode character.
Question - 49 : - How will you convert a single character to its integer value in python?
Answer - 49 : - ord(x) − Converts a single character to its integer value.
Question - 50 : - How will you convert an integer to hexadecimal string in python?
Answer - 50 : - hex(x) − Converts an integer to a hexadecimal string.