We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Practice
  • Certification
  • Compete
  • Career Fair
  • Hiring developers?
  1. Practice
  2. Python
  3. Basic Data Types
  4. List Comprehensions
  5. Discussions

List Comprehensions

Problem
Submissions
Leaderboard
Discussions
Editorial
Tutorial

    You are viewing a single comment's thread. Return to all comments →

  • sohail_shaukat_ 2 years ago+ 0 comments

    range(x,y) will create a range of elements from x to y-1 if only one parameter is passed x is assumed to be 0 so range(y) will create elements in range from 0 till y-1

    so here range(4) will create a range which includes 0,1,2,3 hence the loop will iterate 4 times as there are 4 elements

    16|
    ParentPermalink
  • Contest Calendar
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature