QuestionQ201Verified/Control Flow – Conditional Blocks and LoopsCopy linkReport a problemAsk AstroTutorSave questionWhat is the expected output from the following code? print(len([i for i in range(0, -2)])) A1B3C2D0Show AnswerAnswerExplanationWith its default step of 1, range(0, -2) is empty because it cannot advance upward from 0 toward the exclusive stop value -2. The list comprehension produces an empty list, so len(...) returns 0.Show comments0Show commentsCommunity DiscussionNo comments yet. Be the first to start the discussion!
Community Discussion