Coder Social home page Coder Social logo

learn-python's Introduction

learn-python

practice stups

Reducing the number of times the function is called meoization

high order functions take other functions as arguments, or return them as a results

#pure functions have no side effects, and return a value that depends only on their arguments

#The function map takes a function and an iterable as an arguments, and returns a new iterable with the function applied to each argument

#the function filters an iterable by removing items that don't match a predicate

sets are similar to list or dictionaraies

to create empty set use set(), as {} creates an empty dictionaries

sets are unordered, which means that they can't indexed

#they can not contain duplicate elements

instead of using appennd to add to a set, use add

#the method remove removes a specific elemnet from a set: pop removes an arbitary element

The union operator | combines two sets to from a new one containing items in either

the intersection operator & get items only in both

#the differences operator - gets items in the first set but not in the scond #the symmetric difference operator ^ gets items in either set, but not both

        ######## when to use a dictionary  #######
-- when you need a logical association between a key:value pair
-- when you need fast look up for your data, based on custom key
-- when your data is being constantly modified. Remember dictionaries are mutable

        ######## When to use the other types  #######
-- use list if you have a collection of data that does not need random access. 
-- try to choose list when you need a simple, iterable collection that is modified frequently

-- use a set if you need uniqueness for the elements

-- use the tuples when your data cannot change

#-- many times, a tuples is used in combination with a dictionary, for example
 --, a tuple migth represnt a key, beacuse it's immutable

learn-python's People

Contributors

hridoyalam avatar

Watchers

 avatar  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.