Giter Site home page Giter Site logo

fluency-1's Introduction

Fluency Challenge, Feb 7, 2020

Use list comprehensions to answer the following:

  1. Create a function, tripled that takes an list of numbers and returns an new list consisting of those numbers, tripled.

  2. Create a function, only_negative, that takes an list of numbers and returns a new list consisting only of the negative numbers.

  3. Write a function, total, that takes an list of numbers and returns the sum of those numbers.

  4. Create a function called stripped_strings that takes an list of strings and returns a new list of the strings with all non-alphanumeric characters removed.

  5. Create function, find_lovely that takes an list of words and returns the index of the first occurrence of the word "lovely". If the word "lovely" is not present, it should return -1.

  6. Create a function called valid_contacts. This function takes an list of contact dictionaries. It should return an list of only contact objects that have a phone_number that is a 10-digit string.

contacts = [
  {"name": 'Reuben', "phone_number": '9196218777'},
  {"name": 'Laisha', "phone_number": '0123334766'},
  {"name": 'Cielo', "phone_number": '764'},
  {"name": 'Maya', "phone_number": '7653324599'}
]

valid_contacts(contacts) == [
  {name: 'Reuben', "phone_number": '9196218777'},
  {name: 'Laisha', "phone_number": '0123334766'},
  {name: 'Maya', "phone_number": '7653324599'}
]
  1. Create a function, contact_names, that takes an list of contact objects and returns an list of contact names.
 contacts = [
  {name: 'Reuben', "phone_number": '9196218777'},
  {name: 'Laisha', "phone_number": '0123334766'},
  {name: 'Cielo', "phone_number": '764'},
  {name: 'Maya', "phone_number": '7653324599'}
]

contact_names(contacts) == ['Reuben', 'Laisha', 'Cielo', 'Maya']

fluency-1's People

Contributors

seal125 avatar

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.