Advertisements
Advertisements
Question
Consider the following string myAddress:
myAddress = "WZ-1, New Ganga Nagar, New Delhi"
What will be the output of the following string operation:
print(myAddress.count('New'))
Solution
2
APPEARS IN
RELATED QUESTIONS
Write a short about the following with suitable example: capitalize( )
Write a short about the following with suitable example: swapcase( )
Write a note about count( ) function in python.
Consider the following string mySubject:
mySubject = "Computer Science"
What will be the output of the following string operation:
print(mySubject.isalpha())
Consider the following string myAddress:
myAddress = "WZ-1, New Ganga Nagar, New Delhi"
What will be the output of the following string operation:
print(myAddress.find('New'))
Consider the following string myAddress:
myAddress = "WZ-1, New Ganga Nagar, New Delhi"
What will be the output of the following string operation:
print(myAddress.rfind('New'))
Consider the following string myAddress:
myAddress = "WZ-1, New Ganga Nagar, New Delhi"
What will be the output of the following string operation:
print(myAddress.split(','))
Consider the following string myAddress:
myAddress = "WZ-1, New Ganga Nagar, New Delhi"
What will be the output of the following string operation:
print(myAddress.split(' '))
Consider the following string myAddress:
myAddress = "WZ-1, New Ganga Nagar, New Delhi"
What will be the output of the following string operation:
print(myAddress.partition(','))
Write a user-defined function to convert a string with more than one word into a title case string where the string is passed as a parameter. (Title case means that the first letter of each word is capitalized).