Build a User Configuration Manager - Build a User Configuration Manager

Tell us what’s happening:

Even having looked at the responses to similar questions, I’m unsure as to why I have failed to meet the 27th condition.

Your code so far

test_settings = {
    "theme": "dark",
    'notification': 'enabled',
    "volume": "high"
}

# Each Key Value pair in dict_settings represents a given preference
# For example, Language: English or Notificaitons: Quiet
# Each tuple_setting is a new input to be compared to the existing dict_settings

def add_setting(dictionary, settings):
  
  key = settings[0].lower()
  value = settings[1].lower()

  if key in dictionary:
        return "Setting '" + key +  "' already exists! Cannot add a new setting with this name."
  
  else:
      dictionary[key] = value
      return "Setting '" + key + "' added with value '" + value + "' successfully!"

def update_setting(dictionary, settings):

  key = settings[0].lower()
  value = settings[1].lower()

  if key in dictionary:
      dictionary[key] = value
      return "Setting '" + key + "' updated to '" + value + "' successfully!"
  
  else:
    return "Setting '" + key + "' does not exist! Cannot update a non-existing setting."

def delete_setting (dictionary, settings):

  key = settings.lower()
  
  if key in dictionary:
    dictionary.pop(key)
    return "Setting '" + key + "' deleted successfully!"
  
  else:
    return "Setting not found!"

def view_settings(dictionary):
  if len(dictionary) == 0:
    return "No settings available."
    
  else:
    
    entries = ""
    
    for item in dictionary.items():
      entry = item[0].capitalize() + ": " + item[1] + "\n"
      entries += entry 
      
    return "Current User Settings: \n" + entries + '\n'

print(view_settings(test_settings))

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36

Challenge Information:

Build a User Configuration Manager - Build a User Configuration Manager

try print(repr(view_settings(test_settings)))

you will see where you have extra spaces

I just figured it out. I didn’t realise that the extra space referred to the one between Settings: and \n. Thanks.