हिंदी

Write a function countNow(PLACES) in Python, that takes the dictionary, PLACES as an argument and displays the names (in uppercase) of the places whose names are longer than 5 characters. - Computer Science (Python)

Advertisements
Advertisements

प्रश्न

Write a function countNow (PLACES) in Python, that takes the dictionary, PLACES as an argument and displays the names (in uppercase) of the places whose names are longer than 5 characters.
For example, Consider the following dictionary

PLACES={1:"Delhi",2:"London",3:"Paris",4:"New York",5:"Doha"}

The output should be:

  • LONDON
  • NEW YORK
संक्षेप में उत्तर
Advertisements

उत्तर

PLACES={1:"Delhi",2: "London", 3: "Paris", 4: "New York",5:"Dubai"}
def countNow (PLACES) :
     for place in PLACES. values ():
          if len (place) > 5:
              print (place. upper ())
countNow (PLACES)
shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
2023-2024 (March) Board Sample Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×