What will be the output of `print("Hello".strip())`?

Prepare for the WGU C859 Python Test with quiz questions and explanations. Study with clarity on coding concepts and exam format. Ace your exam!

The output of print("Hello".strip()) will be "Hello" because the strip() method in Python is utilized to remove any leading and trailing whitespace characters from a string. In this case, the string "Hello" contains no extra spaces before or after the text. As such, when the strip() method is applied, it does not modify the string, and the original text remains intact. Therefore, the output will be just "Hello", without any additional spaces or alterations.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy