Junior — Middle
How can a string be converted to uppercase in programming?
sobes.tech AI
Answer from AI
In Python, the method upper() is used to convert a string to uppercase.
Example:
text = "Hello, world!"
upper_text = text.upper()
print(upper_text) # Outputs: HELLO, WORLD!
The upper() method returns a new string where all letters are converted to uppercase, and other characters remain unchanged.