ExamVeda
Login
Home
Python Built In Functions
?

What will be the output of the following code:
my_string = " Hello, World! "
print(my_string.strip())

Answer & Solution
Correct Answer: Option A
The correct answer is Option A: "Hello, World!".
The strip() function in Python is used to remove leading and trailing whitespace (spaces, tabs, and newline characters) from a string. When you call strip() on the string " Hello, World! ", it removes the leading and trailing spaces and returns the modified string "Hello, World!".
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.