What will be the output of the following Python code?print("code. TANTRA".capitalize())OptionsCODE. TANTRAcode. tantraCode. tantraAbc. Def
Question
What will be the output of the following Python code?print("code. TANTRA".capitalize())OptionsCODE. TANTRAcode. tantraCode. tantraAbc. Def
Solution
The output of the Python code print("code. TANTRA".capitalize()) will be Code. tantra.
Here's the step by step explanation:
-
The
capitalize()function in Python converts the first character of a string to a capital (uppercase) letter, while making all other characters in the string lowercase letters. -
In the given code, the string is "code. TANTRA".
-
When the
capitalize()function is applied to this string, the first character 'c' becomes 'C', and all other characters become lowercase, resulting in "Code. tantra".
So, the correct option is Code. tantra.
Similar Questions
lect the correct answerWhat will be the output of the following Python code?print("code TANTRA".capitalize())
What will be the output of the following Python code?>>>pythonclass = "code tantra">>>print("%s" % pythonclass[4:7])Optionstantratacont
What will be the output of the following Python code?>>>ex = "code tantra">>>ex[3] = 's'>>>print exOptionscode tantracodeErrorcose tantra
ect answerWhat will be the output of the following Python code?print("abc. DEF".capitalize())OptionsAbc. defAbc. Defabc. defABC. DEF
Test time left: 01:27:54Select the correct optionWhat will be the output of the following Python code?print("code TANTRA".capitalize())OptionsCODE TANTRACode TantraCode tantracode tantra
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.