Select the correct answerWhat will be the output of the following Python code?print("code. TANTRA".capitalize())Optionscode. tantraCode. tantraAbc. DefCODE. TANTRA
Question
Select the correct answerWhat will be the output of the following Python code?print("code. TANTRA".capitalize())Optionscode. tantraCode. tantraAbc. DefCODE. TANTRA
Solution
The correct answer is "Code. tantra".
In Python, the capitalize() method converts the first character of a string to capital (uppercase) letter. If the string has its first character as capital, then it returns the original string. However, it only capitalizes the first character of the string, not any other characters after spaces. Therefore, "code. TANTRA" becomes "Code. tantra".
Similar Questions
lect the correct answerWhat will be the output of the following Python code?print("code TANTRA".capitalize())
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
Select the correct answerWhat will be the output of the following Python code?print("abc. DEF".capitalize())OptionsAbc. Defabc. defAbc. defABC. DEF
Select the correct answerWhat will be the output of the following Python code?>>>ct1="codetantra">>>ct1[:3]>>>Optionsdecododetacodetantra
What will be the output of the following Python code?>>>pythonclass = "code tantra">>>print("%s" % pythonclass[4:7])Optionstantratacont
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.