Western Governors University (WGU) C859 Introduction to Programming in Python Practice Test

Session length

1 / 400

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

"Hello "

"Hello"

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.

Get further explanation with Examzify DeepDiveBeta

" Hello"

" Hello "

Next Question
Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy