Computer Science, asked by VanilaSky, 26 days ago

Please give appropriate answer...ty​

Attachments:

Answers

Answered by Equestriadash
27

myaddress = "Wazirpur 1, New Yamuna Nagar, New Delhi"

for i in range(len(myaddress)):           #line 1 [a]

     if myaddress[i].islower():               #line 2 [b]

           print(myaddress[i].upper(), end = "")

     elif myaddress[i].isdigit():             #line 3 [c]

          print("*", end = "")

print()

print(len(myaddress.split(",")))           #line 4

print(myaddress.replace("New", "Old"))       #line 5

Output for [d]:

  • 3

Output for [e]:

  • Wazirpur 1, Old Yamuna Nagar, Old Delhi

  • len() is a function that calculates the length of the string.
  • islower() is a method that checks if the string is fully in lowercase or not.
  • isdigit() is a method that checks if the string has only numerical values or not.
  • split() is a method that splits the string into substrings depending on the given separator as the argument. By default, if no separator is specified, it'll separate when there's a space character.
  • replace() is a method that replaces a character/set of characters with new ones.
Similar questions