Examveda
Examveda

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

A. "HELLO, WORLD!"

B. "hello, world!"

C. "Hello, World!"

D. "hello"

Answer: Option A

Solution(By Examveda Team)

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!"

This Question Belongs to Python Program >> Python Built In Functions

Join The Discussion

Related Questions on Python Built In Functions