Vidyalelo
Python · Q10

Python Built

Programming · Python · question 10

Q10

What is the output of the following code:my_string = "Hello, World!"print(my_string.upper())

A.
"HELLO, WORLD!"
Answer
B.
"hello, world!"
C.
"Hello, World!"
D.
"hello"

Answer: Option A

Solution

Answer: Option A
Solution:
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.
my_string = "Hello, World!"
print(my_string.upper())  # Output: "HELLO, WORLD!"