1.

Consider the following string myAddress: myAddress = "WZ-1,New Ganga Nagar,New Delhi"What will be the output of following string operations : print(myAddress.lower()) print(myAddress.upper()) print(myAddress.count('New')) print(myAddress.find('New')) print(myAddress.rfind('New')) print(myAddress.split(',')) print(myAddress.split(' ')) print(myAddress.replace('New','Old')) print(myAddress.partition(',')) print(myAddress.index('Agra'))

Answer» Consider the following string myAddress:

myAddress = "WZ-1,New Ganga Nagar,New Delhi"

What will be the output of following string operations :

  1. print(myAddress.lower())

  2. print(myAddress.upper())

  3. print(myAddress.count('New'))

  4. print(myAddress.find('New'))

  5. print(myAddress.rfind('New'))

  6. print(myAddress.split(','))

  7. print(myAddress.split(' '))

  8. print(myAddress.replace('New','Old'))

  9. print(myAddress.partition(','))

  10. print(myAddress.index('Agra'))



Discussion

No Comment Found

Related InterviewSolutions