QuestionQ54Verified/Data Collections – Tuples, Dictionaries, Lists, and StringsCopy linkReport a problemAsk AstroTutorSave questionConsider this code. Which of the following expressions evaluates to 19?Adata.rfind('an') if data else NoneB19 if None else x / yCdata.find('an') if data else NoneD7 if len(data) > 19 else 6Show AnswerAnswerExplanationstr.find() returns the lowest index at which a substring occurs. The first occurrence of 'an' starts at zero-based index 19, so calling find('an') on the nonempty string returns 19. Python documentation: Built-in TypesLearn morePython documentation: Built-in TypesShow comments0Show commentsCommunity DiscussionNo comments yet. Be the first to start the discussion!
Community Discussion