Giter VIP home page Giter VIP logo

epai_session_8's Introduction

Epai_Session_8

1

Write a closure that takes a function and then check whether the function passed has a docstring with more than 50 characters. 50 is stored as a free variable

  • closure_docstring_check : This fucntion return a closure that check whether a fuction has docstring of character 50 or not. Here 'x' is the local scope where the inner function doc_func takes look up to

2o

Write a closure that gives you the next Fibonacci number

  • next_fibonacci:

  • First we have already define a function "fibonacci" calculating nth term of fibonacci series

  • The next_fibonacci fucntion returns a closure when call gives next term of fibonacci series

3

We wrote a closure that counts how many times a function was called. Write a new one that can keep a track of how many times add/mul/div functions were called, and update a global dictionary variable with the counts

  • Here the closure keeps tracks of the number of times a function is call and then update in the global dictionary "times_count_func"

4

Modify above such that now we can pass in different dictionary variables to update different dictionaries

Earlier in above 3rd question, the closure update only in a global dictionary Here we change in such a way , in the closure we can pass a function and dictionary to keep tracking (# of times function is called)

epai_session_8's People

Contributors

mutum avatar

Watchers

James Cloos 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.