Coder Social home page Coder Social logo

patterns-level-2's Introduction

Patterns-level-2

To understand codes in 'Patterns level 2' lets first revise some basic concepts.

Note:

  • below, range(n) will provide starting 5 values when print(each) is called.

n = 5

for each in range(n):

print(each)

Note:

  • below, range(n, 0, -1) will do the same thing of printing 5 values but, it does so in reverse order.
  • output: (5,4,3,2,1), if n =5.
  • or you can say it will provide starting 5 values, in reverse order with a difference of 1.
  • That is: 5-1 = 4, 4-1 = 3.....and so on.

n = 5

for each in range(n, 0, -1):

print(each)

Note:

  • range(-n+1,n), first the loop will run '-n+1', which results in: -5+1 = -4, -4+1 = -3....till 0.
  • after this, loop will run 'n', which results in 0,1,2,3,4.

n = 5

for each in range(-n+1, n):

print(each)

patterns-level-2's People

Contributors

yashmarmat avatar

Watchers

 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.