?
What is the output of the following code:
What is the output of the following code:
my_string = "Hello, World!"
print(my_string.upper())
print(my_string.upper())
Answer & Solution
Correct Answer:
Option
A
The correct answer is Option A: "HELLO, WORLD!".
The upper() method in Python is used to convert all the characters in a string to uppercase.
So, when you call upper() on the string "Hello, World!", it converts all the letters to uppercase.
The upper() method in Python is used to convert all the characters in a string to uppercase.
So, when you call upper() on the string "Hello, World!", it converts all the letters to uppercase.
my_string = "Hello, World!"
print(my_string.upper()) # Output: "HELLO, WORLD!"
Join the Discussion
Login to post a comment or share your explanation.
Login