Q: What will be the output of the following Python code? print("ab cd ef".expandtabs())
Solution: Each is converted to 8 blank spaces by default.
Q: What will be the output of the following Python code? print("ab cd ef".expandtabs(4))
Solution: Each is converted to 4 blank spaces.
Q: 0
Solution: TypeError, an integer should be passed as an argument.
Q: What will be the output of the following Python code? print("abcdef".find("cd") == "cd" in "abcdef")
Solution: The function find() returns the position of the sunstring in the given string whereas the in keyword returns a value of Boolean type.
Q: What will be the output of the following Python code? print("abcdef".find("cd"))
Solution: The first position in the given string at which the substring can be found is returned.
Q: What will be the output of the following Python code? print("ccdcddcd".find("c"))
Solution: The first position in the given string at which the substring can be found is returned.
You Have Score    | /6 |