3 Replies
      Latest reply on Aug 1, 2018 9:41 AM by igor1
      Cellomaster87 Level 1 Level 1 (0 points)

        Dear all,

         

        I have recently started learning to code with the 'Intro to App Development with Swift' book available on the iBooks Store.

        I have a couple of questions as I am frequently stuck due to what is, in my opinion, a lack of clarity in the questions.

        Sometimes I manage to get around it after a couple of days of thinking and sometimes I just cannot (and often because there were errors in the playgrounds provided).

         

        Here are my questions:

        1) are there provided solutions for the 'Intro to App Development with Swift' curriculum? I know that something is available for the next step, 'App Development with Swift' but I need this first one, at least to be able, after 20-30 minutes of brain crunching, to go look at a hint to let my brain make the next step.

         

        2) if there are not, could somebody help me with Lesson 13? It is the 'QuestionAnswerer' playground, page 'Dealing with Cases'. It explained me this:

         

        let question = "WHERE ARE THE COOKIES?"

        let lowerQuestion = question.lowercased()

        lowerQuestion.hasPrefix("where")

         

        ...where I learned how to check for lower cases and to change an existing string so that it became lowercase (I later learned on my own that also a .uppercased() method existed). Then the playground asks me this:

         

        | Experiment:

             Rewrite the function below to work with aNy cAsE of QueStiOn TeXT, so you get a correct answer in the example:

         

        func responseTo(question: String) -> String {

         

            if question.hasPrefix("hello") {

                return "Why, hello there"

            } else {

                return "That really depends"

            }

        }

         

        ___

        The issue I find with these kind of questions is that it asks you to rewrite the function but doesn't give you any possible hint.

        I tried to add the lines above, I tried with a nested if ... if ... if ... else ... statement but it told me that strings cannot be converted to bool.

        I would understand if you didnt want to write me the solution but I would appreciate a hint on where to go, then I will go.

        Just open me the door and I will cross it

         

        Thank you all

        M