Coder Social home page Coder Social logo

swift-cartoon-collections's Introduction

Objectives

You're going to get familiar with iterating through arrays in a more swifty way.

Instructions

Nothing to clone here! Just use the instructions and build your own file from scratch. No tests on this one.

There are four methods to complete in this lab:

  1. Dwarf Roll Call
  2. Summon Captain Planet
  3. Long Planteer Calls
  4. Find the Cheese

Method 1 - Dwarf Roll Call

dwarves

This method should accept an array of dwarf names, for instance:

["Doc", "Dopey", "Bashful", "Grumpy"]

It should then print out each name using print(). The print-out should look like this:

  1. Doc
  2. Dopey
  3. Bashful
  4. Grumpy

Look up the enumerate method, it might help you out here.

Method 2 - Summon Captain Planet

captain-planet

This method should accept an array of planeteer calls, like this:

planeteerCalls = ["earth", "wind", "fire", "water", "heart"]

It should then capitalize each element and add an exclamation point at the end. The return value of this method should be an array, in this example:

["Earth!", "Wind!", "Fire!", "Water!", "Heart!"]

You have a few options to make this work, try the map method.

Method 3 - Long Planeteer Calls

The longPlaneteerCalls method should accept an array of calls. The method should tell us if any of the calls are longer than four characters by returning a BOOL.

You have a couple of options here to make this work. Try the filter method.

Method 4 - Find the Cheese

The findTheCheese method should accept an array of strings. It should then look through these strings to find and return the first string that is a type of cheese. The types of cheese that appear are "cheddar", "gouda", and "camembert".

For example:

snacks = ["crackers", "gouda", "thyme"]
findTheCheese(snacks)
// returns back "gouda"
soup = ["tomato soup", "cheddar", "oyster crackers", "gouda"]
findTheCheese(soup)
// returns back "cheddar"

If, sadly, a list of ingredients does not include cheese, return "not found":

ingredients = ["garlic", "rosemary", "bread"]
findTheCheese(ingredients)
// returns back "not found"

You can assume that all strings will be lowercase.

swift-cartoon-collections's People

Contributors

fislabstest avatar fs-lms-test-bot avatar jimcampagno avatar sarogers avatar zdrossman avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swift-cartoon-collections's Issues

Update instructions for Swift 2.0

One of the instructions says to use println which no longer a part of a Swift in v2.0 We should check the rest of the instructions for Swift 2.0 compatability.

Create a project with tests

Should we give them a project file for this lab with tests and a solution (for our own reference)? Right now it's just a readme.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.