Q: Which of the following statement prints helloexample est.txt?
Solution: is used to indicate that the next is not an escape sequence.
Q: Suppose s is “ World ”, what is s.strip()?
Solution: Execute help(string.strip) to find details.
Q: The format function, when applied on a string returns ___________
Solution: Format function returns a string.
Q: What will be the output of the “hello” +1+2+3?
Solution: Cannot concatenate str and int objects.
Q: What will be the output of the following Python code? >>>print("D", end = ) >>>print("C", end = ) >>>print("B", end = ) >>>print("A", end = )
Solution: Execute in the shell.
Q: What will be displayed by print(ord(‘b’) – ord(‘a’))?
Solution: ASCII value of b is one more than a. Hence the output of this code is 98-97, which is equal to 1.
Q: Say s=”hello” what will be the return value of type(s)?
Solution: str is used to represent strings in python.
You Have Score    | /7 |