QuestionQ60Verified/Control Flow – Conditional Blocks and LoopsCopy linkReport a problemAsk AstroTutorSave questionWhat occurs when the user executes the following code? AThe code outputs 1.BThe code enters an infinite loop.CThe code outputs 2.DThe code outputs 3.Show AnswerAnswerExplanationrange(5) produces the values 0 through 4, and only 1 and 3 satisfy i % 2 == 1, so total becomes 2. A for statement’s else suite runs when the loop finishes normally without a break, reducing total to 1 before it is printed.Show comments0Show commentsCommunity DiscussionNo comments yet. Be the first to start the discussion!
Community Discussion