Write a function that uses control flow statements.
Open the swift-solving-trivia.xcworkspace
and navigate to the AppDelegate.swift
file. You will need to declare one function in order to get the test to build (⌘ + U
).
Declare a function named solveTrivia(_:)
that takes one argument, a dictionary containing key-value pairs of strings, and returns a string. Write its implementation so that it returns a string containing the answer to the following trivia question:
What is the only state whose capital contains none of the characters as the state name?
Example: Alaska is not the answer because Juneau and Alaska both contain an A.
Is there a way to split a string into characters?
Does your comparison need to be case insensitive?