[{"data":1,"prerenderedAt":6089},["ShallowReactive",2],{"tutorials-python":3,"category-items-python":987,"content-/python/function-recursion":988},[4,22,31,40,49,58,67,76,86,95,104,113,122,131,141,150,159,168,177,186,196,205,214,223,233,242,251,260,269,279,288,297,306,315,324,333,342,351,360,369,379,388,397,406,415,424,433,442,452,461,470,479,488,497,506,515,525,534,543,552,561,570,579,588,597,606,616,625,634,643,652,661,670,680,689,698,707,716,725,734,744,753,762,771,780,789,798,807,817,826,835,844,853,863,872,881,890,900,909,918,927,936,945,953,961,970,979],{"_path":5,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":9,"description":10,"slug":11,"order":12,"isParent":13,"icon":14,"_type":15,"_id":16,"_source":17,"_file":18,"_stem":19,"_extension":20,"children":21,"expanded":13},"/python/getting-started","python",false,"","Getting Started","Begin your Python programming journey. Learn what Python is, how to set it up, and write your first programs. Perfect for complete beginners starting their coding adventure.","getting-started",1,true,"pi pi-folder","markdown","content:python:1.getting-started.md","content","python/1.getting-started.md","python/1.getting-started","md",[22,31,40,49,58,67],{"_path":23,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":24,"description":25,"slug":26,"parentId":5,"order":27,"_type":15,"_id":28,"_source":17,"_file":29,"_stem":30,"_extension":20},"/python/what-is-python","What is Python","Discover Python's fascinating history, design philosophy, and key features. Learn why Python has become one of the world's most popular programming languages and perfect for beginners.","what-is-python",2,"content:python:2.what-is-python.md","python/2.what-is-python.md","python/2.what-is-python",{"_path":32,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":33,"description":34,"slug":35,"parentId":5,"order":36,"_type":15,"_id":37,"_source":17,"_file":38,"_stem":39,"_extension":20},"/python/setup-python","Setup Python","Learn how to install Python on your computer and set up your development environment. Step-by-step guide for Windows, macOS, and Linux with beginner-friendly instructions.","setup-python",3,"content:python:3.setup-python.md","python/3.setup-python.md","python/3.setup-python",{"_path":41,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":42,"description":43,"slug":44,"parentId":5,"order":45,"_type":15,"_id":46,"_source":17,"_file":47,"_stem":48,"_extension":20},"/python/your-first-program","Your First Program","Write and run your first Python program! Learn the basics of Python programming with simple examples and step-by-step instructions for beginners.","your-first-program",4,"content:python:4.your-first-program.md","python/4.your-first-program.md","python/4.your-first-program",{"_path":50,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":51,"description":52,"slug":53,"parentId":5,"order":54,"_type":15,"_id":55,"_source":17,"_file":56,"_stem":57,"_extension":20},"/python/python-code-structure","Python Code Structure","Learn how Python code is organized and structured. Understand indentation, line breaks, and the basic rules that make Python programs work correctly.","python-code-structure",5,"content:python:5.python-code-structure.md","python/5.python-code-structure.md","python/5.python-code-structure",{"_path":59,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":60,"description":61,"slug":62,"parentId":5,"order":63,"_type":15,"_id":64,"_source":17,"_file":65,"_stem":66,"_extension":20},"/python/writing-comments","Writing Comments","Learn how to write effective comments in Python. Discover when and how to document your code to make it clear, maintainable, and easy to understand.","writing-comments",6,"content:python:6.writing-comments.md","python/6.writing-comments.md","python/6.writing-comments",{"_path":68,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":69,"description":70,"slug":71,"parentId":5,"order":72,"_type":15,"_id":73,"_source":17,"_file":74,"_stem":75,"_extension":20},"/python/working-with-variables","Working with Variables","Learn how to create, use, and manage variables in Python. Understand how to store data, change values, and follow naming conventions for clean, readable code.","working-with-variables",7,"content:python:7.working-with-variables.md","python/7.working-with-variables.md","python/7.working-with-variables",{"_path":77,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":78,"description":79,"slug":80,"order":81,"isParent":13,"icon":14,"_type":15,"_id":82,"_source":17,"_file":83,"_stem":84,"_extension":20,"children":85,"expanded":13},"/python/basic-data-types","Basic Data Types","Learn about Python's fundamental data types including numbers, text, and boolean values","basic-data-types",8,"content:python:8.basic-data-types.md","python/8.basic-data-types.md","python/8.basic-data-types",[86,95,104,113,122],{"_path":87,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":88,"description":89,"slug":90,"parentId":77,"order":91,"_type":15,"_id":92,"_source":17,"_file":93,"_stem":94,"_extension":20},"/python/understanding-data-types","Understanding Data Types","Learn how Python identifies different data types and why they're important for programming","understanding-data-types",9,"content:python:9.understanding-data-types.md","python/9.understanding-data-types.md","python/9.understanding-data-types",{"_path":96,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":97,"description":98,"slug":99,"parentId":77,"order":100,"_type":15,"_id":101,"_source":17,"_file":102,"_stem":103,"_extension":20},"/python/working-with-numbers","Working with Numbers","Learn about Python's numeric data types including integers and floats, and how to perform calculations","working-with-numbers",10,"content:python:10.working-with-numbers.md","python/10.working-with-numbers.md","python/10.working-with-numbers",{"_path":105,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":106,"description":107,"slug":108,"parentId":77,"order":109,"_type":15,"_id":110,"_source":17,"_file":111,"_stem":112,"_extension":20},"/python/text-and-strings","Text and Strings","Learn how to work with text data in Python using strings, including creation, manipulation, and formatting","text-and-strings",11,"content:python:11.text-and-strings.md","python/11.text-and-strings.md","python/11.text-and-strings",{"_path":114,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":115,"description":116,"slug":117,"parentId":77,"order":118,"_type":15,"_id":119,"_source":17,"_file":120,"_stem":121,"_extension":20},"/python/true-false-values","True/False Values","Learn about boolean values in Python, including True/False logic, comparison operations, and how to use booleans for decision-making in your programs","true-false-values",12,"content:python:12.true-false-values.md","python/12.true-false-values.md","python/12.true-false-values",{"_path":123,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":124,"description":125,"slug":126,"parentId":77,"order":127,"_type":15,"_id":128,"_source":17,"_file":129,"_stem":130,"_extension":20},"/python/converting-types","Converting Types","Learn how to convert between different Python data types including strings, numbers, and booleans","converting-types",13,"content:python:13.converting-types.md","python/13.converting-types.md","python/13.converting-types",{"_path":132,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":133,"description":134,"slug":135,"order":136,"isParent":13,"icon":14,"_type":15,"_id":137,"_source":17,"_file":138,"_stem":139,"_extension":20,"children":140,"expanded":13},"/python/python-operators","Python Operators","Learn about Python operators - the symbols and keywords that perform operations on data. Discover arithmetic, comparison, logical, and assignment operators with simple examples.","python-operators",14,"content:python:14.python-operators.md","python/14.python-operators.md","python/14.python-operators",[141,150,159,168,177],{"_path":142,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":143,"description":144,"slug":145,"parentId":132,"order":146,"_type":15,"_id":147,"_source":17,"_file":148,"_stem":149,"_extension":20},"/python/math-operations","Math Operations","Learn Python's arithmetic operators for mathematical calculations. Master addition, subtraction, multiplication, division, and more with practical examples.","math-operations",15,"content:python:15.math-operations.md","python/15.math-operations.md","python/15.math-operations",{"_path":151,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":152,"description":153,"slug":154,"parentId":132,"order":155,"_type":15,"_id":156,"_source":17,"_file":157,"_stem":158,"_extension":20},"/python/comparing-values","Comparing Values","Learn Python's comparison operators to compare values and make decisions. Master equality, inequality, and relational operators with practical examples.","comparing-values",16,"content:python:16.comparing-values.md","python/16.comparing-values.md","python/16.comparing-values",{"_path":160,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":161,"description":162,"slug":163,"parentId":132,"order":164,"_type":15,"_id":165,"_source":17,"_file":166,"_stem":167,"_extension":20},"/python/logic-operations","Logic Operations","Learn about Python's logical operators for combining conditions and creating complex boolean expressions","logic-operations",17,"content:python:17.logic-operations.md","python/17.logic-operations.md","python/17.logic-operations",{"_path":169,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":170,"description":171,"slug":172,"parentId":132,"order":173,"_type":15,"_id":174,"_source":17,"_file":175,"_stem":176,"_extension":20},"/python/value-assignment","Value Assignment","Learn about Python's assignment operators for efficiently updating variables and performing calculations","value-assignment",18,"content:python:18.value-assignment.md","python/18.value-assignment.md","python/18.value-assignment",{"_path":178,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":179,"description":180,"slug":181,"parentId":132,"order":182,"_type":15,"_id":183,"_source":17,"_file":184,"_stem":185,"_extension":20},"/python/operator-precedence","Operator Precedence","Learn how Python evaluates expressions with multiple operators and how to control evaluation order","operator-precedence",19,"content:python:19.operator-precedence.md","python/19.operator-precedence.md","python/19.operator-precedence",{"_path":187,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":188,"description":189,"slug":190,"order":191,"isParent":13,"icon":14,"_type":15,"_id":192,"_source":17,"_file":193,"_stem":194,"_extension":20,"children":195,"expanded":13},"/python/decision-making","Decision Making","Learn how to make decisions in your Python programs using conditional statements and control flow","decision-making",20,"content:python:20.decision-making.md","python/20.decision-making.md","python/20.decision-making",[196,205,214],{"_path":197,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":198,"description":199,"slug":200,"parentId":187,"order":201,"_type":15,"_id":202,"_source":17,"_file":203,"_stem":204,"_extension":20},"/python/if-statements","If Statements","Learn how to use if statements to make decisions and control program flow in Python","if-statements",21,"content:python:21.if-statements.md","python/21.if-statements.md","python/21.if-statements",{"_path":206,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":207,"description":208,"slug":209,"parentId":187,"order":210,"_type":15,"_id":211,"_source":17,"_file":212,"_stem":213,"_extension":20},"/python/multiple-conditions","Multiple Conditions","Learn how to handle multiple conditions using elif statements and complex conditional logic in Python","multiple-conditions",22,"content:python:22.multiple-conditions.md","python/22.multiple-conditions.md","python/22.multiple-conditions",{"_path":215,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":216,"description":217,"slug":218,"parentId":187,"order":219,"_type":15,"_id":220,"_source":17,"_file":221,"_stem":222,"_extension":20},"/python/pattern-matching","Pattern Matching","Learn how to use Python's match-case statements for powerful pattern matching and complex decision making","pattern-matching",23,"content:python:23.pattern-matching.md","python/23.pattern-matching.md","python/23.pattern-matching",{"_path":224,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":225,"description":226,"slug":227,"order":228,"isParent":13,"icon":14,"_type":15,"_id":229,"_source":17,"_file":230,"_stem":231,"_extension":20,"children":232,"expanded":13},"/python/repetition-and-loops","Python Loops","Learn how to use loops to repeat code efficiently and handle repetitive tasks in Python","repetition-and-loops",24,"content:python:24.repetition-and-loops.md","python/24.repetition-and-loops.md","python/24.repetition-and-loops",[233,242,251,260],{"_path":234,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":235,"description":236,"slug":237,"parentId":224,"order":238,"_type":15,"_id":239,"_source":17,"_file":240,"_stem":241,"_extension":20},"/python/while-loops","While Loops","Learn how to use while loops for condition-based repetition and create loops that run until specific conditions are met","while-loops",25,"content:python:25.while-loops.md","python/25.while-loops.md","python/25.while-loops",{"_path":243,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":244,"description":245,"slug":246,"parentId":224,"order":247,"_type":15,"_id":248,"_source":17,"_file":249,"_stem":250,"_extension":20},"/python/for-loops","For Loops","Learn how to use for loops to iterate through sequences, collections, and ranges efficiently in Python","for-loops",26,"content:python:26.for-loops.md","python/26.for-loops.md","python/26.for-loops",{"_path":252,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":253,"description":254,"slug":255,"parentId":224,"order":256,"_type":15,"_id":257,"_source":17,"_file":258,"_stem":259,"_extension":20},"/python/loop-control","Loop Control","Master advanced loop control techniques including break, continue, and else clauses for sophisticated iteration patterns","loop-control",27,"content:python:27.loop-control.md","python/27.loop-control.md","python/27.loop-control",{"_path":261,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":262,"description":263,"slug":264,"parentId":224,"order":265,"_type":15,"_id":266,"_source":17,"_file":267,"_stem":268,"_extension":20},"/python/nested-loops","Nested Loops","Learn how to use nested loops to process multi-dimensional data, create patterns, and handle complex iteration scenarios","nested-loops",28,"content:python:28.nested-loops.md","python/28.nested-loops.md","python/28.nested-loops",{"_path":270,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":271,"description":272,"slug":273,"order":274,"isParent":13,"icon":14,"_type":15,"_id":275,"_source":17,"_file":276,"_stem":277,"_extension":20,"children":278,"expanded":13},"/python/python-lists","Python Lists","Learn about Python lists, one of the most important and versatile data structures for storing and organizing collections of data","python-lists",29,"content:python:29.python-lists.md","python/29.python-lists.md","python/29.python-lists",[279,288,297,306,315,324,333,342,351,360],{"_path":280,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":281,"description":282,"slug":283,"parentId":270,"order":284,"_type":15,"_id":285,"_source":17,"_file":286,"_stem":287,"_extension":20},"/python/creating-lists","Creating Lists","Learn different methods to create and initialize Python lists, from simple literals to advanced techniques","creating-lists",30,"content:python:30.creating-lists.md","python/30.creating-lists.md","python/30.creating-lists",{"_path":289,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":290,"description":291,"slug":292,"parentId":270,"order":293,"_type":15,"_id":294,"_source":17,"_file":295,"_stem":296,"_extension":20},"/python/reading-list-data","Reading List Data","Master techniques for accessing and retrieving data from Python lists using indexing, slicing, and built-in methods","reading-list-data",31,"content:python:31.reading-list-data.md","python/31.reading-list-data.md","python/31.reading-list-data",{"_path":298,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":299,"description":300,"slug":301,"parentId":270,"order":302,"_type":15,"_id":303,"_source":17,"_file":304,"_stem":305,"_extension":20},"/python/modifying-lists","Modifying Lists","Learn how to change, update, and modify existing elements in Python lists using indexing and various methods","modifying-lists",32,"content:python:32.modifying-lists.md","python/32.modifying-lists.md","python/32.modifying-lists",{"_path":307,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":308,"description":309,"slug":310,"parentId":270,"order":311,"_type":15,"_id":312,"_source":17,"_file":313,"_stem":314,"_extension":20},"/python/adding-to-lists","Adding to Lists","Learn various methods to add elements to Python lists including append, insert, extend, and concatenation techniques","adding-to-lists",33,"content:python:33.adding-to-lists.md","python/33.adding-to-lists.md","python/33.adding-to-lists",{"_path":316,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":317,"description":318,"slug":319,"parentId":270,"order":320,"_type":15,"_id":321,"_source":17,"_file":322,"_stem":323,"_extension":20},"/python/removing-from-lists","Removing from Lists","Learn different methods to remove and delete elements from Python lists including remove, pop, del, and clear","removing-from-lists",34,"content:python:34.removing-from-lists.md","python/34.removing-from-lists.md","python/34.removing-from-lists",{"_path":325,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":326,"description":327,"slug":328,"parentId":270,"order":329,"_type":15,"_id":330,"_source":17,"_file":331,"_stem":332,"_extension":20},"/python/looping-through-lists","Looping Through Lists","Learn different ways to iterate through Python lists using for loops, while loops, enumerate, and other iteration techniques","looping-through-lists",35,"content:python:35.looping-through-lists.md","python/35.looping-through-lists.md","python/35.looping-through-lists",{"_path":334,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":335,"description":336,"slug":337,"parentId":270,"order":338,"_type":15,"_id":339,"_source":17,"_file":340,"_stem":341,"_extension":20},"/python/list-shortcuts","List Shortcuts","Learn powerful Python list shortcuts including list comprehensions, slicing tricks, and built-in functions for efficient list operations","list-shortcuts",36,"content:python:36.list-shortcuts.md","python/36.list-shortcuts.md","python/36.list-shortcuts",{"_path":343,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":344,"description":345,"slug":346,"parentId":270,"order":347,"_type":15,"_id":348,"_source":17,"_file":349,"_stem":350,"_extension":20},"/python/organizing-lists","Organizing Lists","Learn how to sort, reverse, and organize Python lists using built-in methods and custom sorting techniques","organizing-lists",37,"content:python:37.organizing-lists.md","python/37.organizing-lists.md","python/37.organizing-lists",{"_path":352,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":353,"description":354,"slug":355,"parentId":270,"order":356,"_type":15,"_id":357,"_source":17,"_file":358,"_stem":359,"_extension":20},"/python/combining-lists","Combining Lists","Learn various techniques to combine, merge, and join Python lists including concatenation, zipping, and advanced merging strategies","combining-lists",38,"content:python:38.combining-lists.md","python/38.combining-lists.md","python/38.combining-lists",{"_path":361,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":362,"description":363,"slug":364,"parentId":270,"order":365,"_type":15,"_id":366,"_source":17,"_file":367,"_stem":368,"_extension":20},"/python/essential-list-tools","Essential List Tools","Master powerful built-in functions and advanced techniques for efficient Python list manipulation and data processing","essential-list-tools",39,"content:python:39.essential-list-tools.md","python/39.essential-list-tools.md","python/39.essential-list-tools",{"_path":370,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":371,"description":372,"slug":373,"order":374,"isParent":13,"icon":14,"_type":15,"_id":375,"_source":17,"_file":376,"_stem":377,"_extension":20,"children":378,"expanded":13},"/python/python-tuples","Python Tuples","Master Python tuples - immutable sequences perfect for storing related data that shouldn't change. Learn creation, access, and manipulation techniques.","python-tuples",40,"content:python:40.python-tuples.md","python/40.python-tuples.md","python/40.python-tuples",[379,388,397,406,415,424,433],{"_path":380,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":381,"description":382,"slug":383,"parentId":370,"order":384,"_type":15,"_id":385,"_source":17,"_file":386,"_stem":387,"_extension":20},"/python/creating-tuples","Creating Tuples","Learn different ways to create Python tuples, from basic syntax to advanced techniques. Master tuple initialization and understand when to use tuples.","creating-tuples",41,"content:python:41.creating-tuples.md","python/41.creating-tuples.md","python/41.creating-tuples",{"_path":389,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":390,"description":391,"slug":392,"parentId":370,"order":393,"_type":15,"_id":394,"_source":17,"_file":395,"_stem":396,"_extension":20},"/python/reading-tuple-data","Reading Tuple Data","Master accessing tuple elements through indexing, slicing, and searching. Learn efficient patterns for reading and working with tuple data.","reading-tuple-data",42,"content:python:42.reading-tuple-data.md","python/42.reading-tuple-data.md","python/42.reading-tuple-data",{"_path":398,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":399,"description":400,"slug":401,"parentId":370,"order":402,"_type":15,"_id":403,"_source":17,"_file":404,"_stem":405,"_extension":20},"/python/changing-tuples","Changing Tuples","Understand tuple immutability and learn techniques for working with unchangeable data. Master creating modified tuple versions and handling immutable constraints.","changing-tuples",43,"content:python:43.changing-tuples.md","python/43.changing-tuples.md","python/43.changing-tuples",{"_path":407,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":408,"description":409,"slug":410,"parentId":370,"order":411,"_type":15,"_id":412,"_source":17,"_file":413,"_stem":414,"_extension":20},"/python/tuple-unpacking","Tuple Unpacking","Master tuple unpacking for elegant variable assignment, function returns, and data extraction. Learn Python's powerful unpacking syntax and patterns.","tuple-unpacking",44,"content:python:44.tuple-unpacking.md","python/44.tuple-unpacking.md","python/44.tuple-unpacking",{"_path":416,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":417,"description":418,"slug":419,"parentId":370,"order":420,"_type":15,"_id":421,"_source":17,"_file":422,"_stem":423,"_extension":20},"/python/iterating-tuples","Iterating Tuples","Master tuple iteration techniques for processing sequence data. Learn basic loops, enumerate, nested iteration, and advanced patterns for efficient data processing.","iterating-tuples",45,"content:python:45.iterating-tuples.md","python/45.iterating-tuples.md","python/45.iterating-tuples",{"_path":425,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":426,"description":427,"slug":428,"parentId":370,"order":429,"_type":15,"_id":430,"_source":17,"_file":431,"_stem":432,"_extension":20},"/python/merging-tuples","Merging Tuples","Learn techniques for combining and merging tuples to create larger data structures. Master concatenation, joining multiple tuples, and advanced merging patterns.","merging-tuples",46,"content:python:46.merging-tuples.md","python/46.merging-tuples.md","python/46.merging-tuples",{"_path":434,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":435,"description":436,"slug":437,"parentId":370,"order":438,"_type":15,"_id":439,"_source":17,"_file":440,"_stem":441,"_extension":20},"/python/tuple-operations","Tuple Operations","Master comprehensive tuple operations including built-in functions, mathematical operations, comparisons, and advanced techniques for efficient tuple manipulation.","tuple-operations",47,"content:python:47.tuple-operations.md","python/47.tuple-operations.md","python/47.tuple-operations",{"_path":443,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":444,"description":445,"slug":446,"order":447,"isParent":13,"icon":14,"_type":15,"_id":448,"_source":17,"_file":449,"_stem":450,"_extension":20,"children":451,"expanded":13},"/python/python-sets","Python Sets","Discover Python sets - unique collections that automatically eliminate duplicates and provide powerful mathematical operations for data filtering and analysis.","python-sets",48,"content:python:48.python-sets.md","python/48.python-sets.md","python/48.python-sets",[452,461,470,479,488,497,506],{"_path":453,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":454,"description":455,"slug":456,"parentId":443,"order":457,"_type":15,"_id":458,"_source":17,"_file":459,"_stem":460,"_extension":20},"/python/creating-sets","Creating Sets","Learn multiple ways to create sets in Python including literal syntax, set() function, and set comprehensions. Master set creation from different data sources.","creating-sets",49,"content:python:49.creating-sets.md","python/49.creating-sets.md","python/49.creating-sets",{"_path":462,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":463,"description":464,"slug":465,"parentId":443,"order":466,"_type":15,"_id":467,"_source":17,"_file":468,"_stem":469,"_extension":20},"/python/reading-set-data","Reading Set Data","Learn how to access and examine set data in Python including membership testing, iteration, size checking, and converting sets to other data types.","reading-set-data",50,"content:python:50.reading-set-data.md","python/50.reading-set-data.md","python/50.reading-set-data",{"_path":471,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":472,"description":473,"slug":474,"parentId":443,"order":475,"_type":15,"_id":476,"_source":17,"_file":477,"_stem":478,"_extension":20},"/python/adding-to-sets","Adding to Sets","Learn how to add elements to sets in Python using add(), update(), and union operations. Master growing sets dynamically with single items and multiple elements.","adding-to-sets",51,"content:python:51.adding-to-sets.md","python/51.adding-to-sets.md","python/51.adding-to-sets",{"_path":480,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":481,"description":482,"slug":483,"parentId":443,"order":484,"_type":15,"_id":485,"_source":17,"_file":486,"_stem":487,"_extension":20},"/python/removing-from-sets","Removing from Sets","Learn how to remove elements from Python sets using different methods like remove(), discard(), pop(), and clear()","removing-from-sets",52,"content:python:52.removing-from-sets.md","python/52.removing-from-sets.md","python/52.removing-from-sets",{"_path":489,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":490,"description":491,"slug":492,"parentId":443,"order":493,"_type":15,"_id":494,"_source":17,"_file":495,"_stem":496,"_extension":20},"/python/iterating-sets","Iterating Sets","Learn different ways to iterate through Python sets using for loops, comprehensions, and built-in functions","iterating-sets",53,"content:python:53.iterating-sets.md","python/53.iterating-sets.md","python/53.iterating-sets",{"_path":498,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":499,"description":500,"slug":501,"parentId":443,"order":502,"_type":15,"_id":503,"_source":17,"_file":504,"_stem":505,"_extension":20},"/python/combining-sets","Combining Sets","Learn how to combine Python sets using union, intersection, difference, and other set operations","combining-sets",54,"content:python:54.combining-sets.md","python/54.combining-sets.md","python/54.combining-sets",{"_path":507,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":508,"description":509,"slug":510,"parentId":443,"order":511,"_type":15,"_id":512,"_source":17,"_file":513,"_stem":514,"_extension":20},"/python/set-operations","Set Operations","Learn advanced Python set operations including comparisons, subsets, supersets, and mathematical set relationships","set-operations",55,"content:python:55.set-operations.md","python/55.set-operations.md","python/55.set-operations",{"_path":516,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":517,"description":518,"slug":519,"order":520,"isParent":13,"icon":14,"_type":15,"_id":521,"_source":17,"_file":522,"_stem":523,"_extension":20,"children":524,"expanded":13},"/python/python-dictionaries","Python Dictionaries","Learn about Python dictionaries - key-value data structures for storing and organizing related information","python-dictionaries",56,"content:python:56.python-dictionaries.md","python/56.python-dictionaries.md","python/56.python-dictionaries",[525,534,543,552,561,570,579,588,597],{"_path":526,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":527,"description":528,"slug":529,"parentId":516,"order":530,"_type":15,"_id":531,"_source":17,"_file":532,"_stem":533,"_extension":20},"/python/creating-dictionaries","Creating Dictionaries","Learn different methods to create Python dictionaries using literals, constructors, and comprehensions","creating-dictionaries",57,"content:python:57.creating-dictionaries.md","python/57.creating-dictionaries.md","python/57.creating-dictionaries",{"_path":535,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":536,"description":537,"slug":538,"parentId":516,"order":539,"_type":15,"_id":540,"_source":17,"_file":541,"_stem":542,"_extension":20},"/python/getting-dictionary-values","Getting Dictionary Values","Learn safe and efficient methods to retrieve data from Python dictionaries using various access techniques","getting-dictionary-values",58,"content:python:58.getting-dictionary-values.md","python/58.getting-dictionary-values.md","python/58.getting-dictionary-values",{"_path":544,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":545,"description":546,"slug":547,"parentId":516,"order":548,"_type":15,"_id":549,"_source":17,"_file":550,"_stem":551,"_extension":20},"/python/updating-dictionaries","Updating Dictionaries","Learn how to modify and maintain Python dictionary data using various update methods and techniques","updating-dictionaries",59,"content:python:59.updating-dictionaries.md","python/59.updating-dictionaries.md","python/59.updating-dictionaries",{"_path":553,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":554,"description":555,"slug":556,"parentId":516,"order":557,"_type":15,"_id":558,"_source":17,"_file":559,"_stem":560,"_extension":20},"/python/adding-dictionary-items","Adding Dictionary Items","Learn effective techniques for adding new items to Python dictionaries with various methods and best practices","adding-dictionary-items",60,"content:python:60.adding-dictionary-items.md","python/60.adding-dictionary-items.md","python/60.adding-dictionary-items",{"_path":562,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":563,"description":564,"slug":565,"parentId":516,"order":566,"_type":15,"_id":567,"_source":17,"_file":568,"_stem":569,"_extension":20},"/python/deleting-dictionary-items","Deleting Dictionary Items","Master safe and efficient techniques for removing items from Python dictionaries with various methods and error handling","deleting-dictionary-items",61,"content:python:61.deleting-dictionary-items.md","python/61.deleting-dictionary-items.md","python/61.deleting-dictionary-items",{"_path":571,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":572,"description":573,"slug":574,"parentId":516,"order":575,"_type":15,"_id":576,"_source":17,"_file":577,"_stem":578,"_extension":20},"/python/looping-dictionaries","Looping Dictionaries","Learn efficient techniques for iterating through Python dictionaries using keys, values, and items","looping-dictionaries",62,"content:python:62.looping-dictionaries.md","python/62.looping-dictionaries.md","python/62.looping-dictionaries",{"_path":580,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":581,"description":582,"slug":583,"parentId":516,"order":584,"_type":15,"_id":585,"_source":17,"_file":586,"_stem":587,"_extension":20},"/python/dictionary-copies","Dictionary Copies","Learn safe techniques for duplicating Python dictionaries using shallow and deep copy methods","dictionary-copies",63,"content:python:63.dictionary-copies.md","python/63.dictionary-copies.md","python/63.dictionary-copies",{"_path":589,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":590,"description":591,"slug":592,"parentId":516,"order":593,"_type":15,"_id":594,"_source":17,"_file":595,"_stem":596,"_extension":20},"/python/multi-level-dictionaries","Multi-level Dictionaries","Master working with nested Python dictionaries for complex data structures and hierarchical information","multi-level-dictionaries",64,"content:python:64.multi-level-dictionaries.md","python/64.multi-level-dictionaries.md","python/64.multi-level-dictionaries",{"_path":598,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":599,"description":600,"slug":601,"parentId":516,"order":602,"_type":15,"_id":603,"_source":17,"_file":604,"_stem":605,"_extension":20},"/python/dictionary-tools","Dictionary Tools","Explore powerful built-in functions and advanced techniques for efficient Python dictionary manipulation and analysis","dictionary-tools",65,"content:python:65.dictionary-tools.md","python/65.dictionary-tools.md","python/65.dictionary-tools",{"_path":607,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":608,"description":609,"slug":610,"order":611,"isParent":13,"icon":14,"_type":15,"_id":612,"_source":17,"_file":613,"_stem":614,"_extension":20,"children":615,"expanded":13},"/python/python-functions","Python Functions","Learn how to create and use Python functions to organize code into reusable, modular components that make programs more efficient and maintainable","python-functions",66,"content:python:66.python-functions.md","python/66.python-functions.md","python/66.python-functions",[616,625,634,643,652,661],{"_path":617,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":618,"description":619,"slug":620,"parentId":607,"order":621,"_type":15,"_id":622,"_source":17,"_file":623,"_stem":624,"_extension":20},"/python/function-basics","Function Basics","Learn the fundamentals of creating and using Python functions to organize code into reusable, modular components","function-basics",67,"content:python:67.function-basics.md","python/67.function-basics.md","python/67.function-basics",{"_path":626,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":627,"description":628,"slug":629,"parentId":607,"order":630,"_type":15,"_id":631,"_source":17,"_file":632,"_stem":633,"_extension":20},"/python/function-parameters","Function Parameters","Master different types of Python function parameters including positional, keyword, default, and variable-length arguments","function-parameters",68,"content:python:68.function-parameters.md","python/68.function-parameters.md","python/68.function-parameters",{"_path":635,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":636,"description":637,"slug":638,"parentId":607,"order":639,"_type":15,"_id":640,"_source":17,"_file":641,"_stem":642,"_extension":20},"/python/returning-values","Returning Values","Learn different ways Python functions return data including single values, multiple values, and conditional returns","returning-values",69,"content:python:69.returning-values.md","python/69.returning-values.md","python/69.returning-values",{"_path":644,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":645,"description":646,"slug":647,"parentId":607,"order":648,"_type":15,"_id":649,"_source":17,"_file":650,"_stem":651,"_extension":20},"/python/variable-scope","Variable Scope","Understand Python variable scope including local, global, and nonlocal variables and how they affect function behavior","variable-scope",70,"content:python:70.variable-scope.md","python/70.variable-scope.md","python/70.variable-scope",{"_path":653,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":654,"description":655,"slug":656,"parentId":607,"order":657,"_type":15,"_id":658,"_source":17,"_file":659,"_stem":660,"_extension":20},"/python/anonymous-functions","Anonymous Functions","Learn to create and use Python lambda functions for concise, inline function definitions and functional programming patterns","anonymous-functions",71,"content:python:71.anonymous-functions.md","python/71.anonymous-functions.md","python/71.anonymous-functions",{"_path":662,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":663,"description":664,"slug":665,"parentId":607,"order":666,"_type":15,"_id":667,"_source":17,"_file":668,"_stem":669,"_extension":20},"/python/function-recursion","Function Recursion","Master recursive functions in Python by learning how functions can call themselves to solve complex problems with elegant, mathematical solutions","function-recursion",72,"content:python:72.function-recursion.md","python/72.function-recursion.md","python/72.function-recursion",{"_path":671,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":672,"description":673,"slug":674,"order":675,"isParent":13,"icon":14,"_type":15,"_id":676,"_source":17,"_file":677,"_stem":678,"_extension":20,"children":679},"/python/object-programming","Object Programming","Learn object-oriented programming (OOP) in Python - create classes, objects, and methods to build organized, reusable code","object-programming",73,"content:python:73.object-programming.md","python/73.object-programming.md","python/73.object-programming",[680,689,698,707,716,725],{"_path":681,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":682,"description":683,"slug":684,"parentId":671,"order":685,"_type":15,"_id":686,"_source":17,"_file":687,"_stem":688,"_extension":20},"/python/classes-and-objects","Classes and Objects","Learn to create Python classes and objects - the foundation of object-oriented programming for building reusable, organized code","classes-and-objects",74,"content:python:74.classes-and-objects.md","python/74.classes-and-objects.md","python/74.classes-and-objects",{"_path":690,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":691,"description":692,"slug":693,"parentId":671,"order":694,"_type":15,"_id":695,"_source":17,"_file":696,"_stem":697,"_extension":20},"/python/object-methods","Object Methods","Master object methods in Python - learn to define behaviors, work with parameters, and create interactive objects that respond to actions","object-methods",75,"content:python:75.object-methods.md","python/75.object-methods.md","python/75.object-methods",{"_path":699,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":700,"description":701,"slug":702,"parentId":671,"order":703,"_type":15,"_id":704,"_source":17,"_file":705,"_stem":706,"_extension":20},"/python/class-inheritance","Class Inheritance","Learn Python class inheritance - create specialized classes that build upon existing functionality while adding new features and behaviors","class-inheritance",76,"content:python:76.class-inheritance.md","python/76.class-inheritance.md","python/76.class-inheritance",{"_path":708,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":709,"description":710,"slug":711,"parentId":671,"order":712,"_type":15,"_id":713,"_source":17,"_file":714,"_stem":715,"_extension":20},"/python/method-overriding","Method Overriding","Master method overriding in Python - learn to customize inherited methods, use super(), and create specialized behaviors while maintaining inheritance benefits","method-overriding",77,"content:python:77.method-overriding.md","python/77.method-overriding.md","python/77.method-overriding",{"_path":717,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":718,"description":719,"slug":720,"parentId":671,"order":721,"_type":15,"_id":722,"_source":17,"_file":723,"_stem":724,"_extension":20},"/python/variable-visibility","Variable Visibility","Master Python variable visibility - learn public, protected, and private attributes to control access and create well-encapsulated classes","variable-visibility",78,"content:python:78.variable-visibility.md","python/78.variable-visibility.md","python/78.variable-visibility",{"_path":726,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":727,"description":728,"slug":729,"parentId":671,"order":730,"_type":15,"_id":731,"_source":17,"_file":732,"_stem":733,"_extension":20},"/python/special-methods","Special Methods","Master Python special methods (magic methods) - learn to implement __str__, __len__, __eq__ and more to make your classes work seamlessly with Python's built-in functions","special-methods",79,"content:python:79.special-methods.md","python/79.special-methods.md","python/79.special-methods",{"_path":735,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":736,"description":737,"slug":738,"order":739,"isParent":13,"icon":14,"_type":15,"_id":740,"_source":17,"_file":741,"_stem":742,"_extension":20,"children":743},"/python/advanced-concepts","Advanced Concepts","Master advanced Python programming concepts - work with dates, mathematics, JSON data, pattern matching, and more sophisticated programming techniques","advanced-concepts",80,"content:python:80.advanced-concepts.md","python/80.advanced-concepts.md","python/80.advanced-concepts",[744,753,762,771,780,789,798],{"_path":745,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":746,"description":747,"slug":748,"parentId":735,"order":749,"_type":15,"_id":750,"_source":17,"_file":751,"_stem":752,"_extension":20},"/python/working-with-dates","Working with Dates","Master Python date and time handling - work with datetime objects, format dates, calculate durations, and build time-aware applications","working-with-dates",81,"content:python:81.working-with-dates.md","python/81.working-with-dates.md","python/81.working-with-dates",{"_path":754,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":755,"description":756,"slug":757,"parentId":735,"order":758,"_type":15,"_id":759,"_source":17,"_file":760,"_stem":761,"_extension":20},"/python/mathematical-operations","Mathematical Operations","Master Python mathematical computing - use math functions, perform statistical calculations, and implement scientific computing for data analysis and problem-solving","mathematical-operations",82,"content:python:82.mathematical-operations.md","python/82.mathematical-operations.md","python/82.mathematical-operations",{"_path":763,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":764,"description":765,"slug":766,"parentId":735,"order":767,"_type":15,"_id":768,"_source":17,"_file":769,"_stem":770,"_extension":20},"/python/json-data","JSON Data","Master JSON data handling in Python - serialize and deserialize data, work with APIs, manage configuration files, and exchange data between applications","json-data",83,"content:python:83.json-data.md","python/83.json-data.md","python/83.json-data",{"_path":772,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":773,"description":774,"slug":775,"parentId":735,"order":776,"_type":15,"_id":777,"_source":17,"_file":778,"_stem":779,"_extension":20},"/python/package-management","Package Management","Master Python package management with pip and virtual environments - install libraries, manage dependencies, create isolated environments, and distribute packages professionally","package-management",85,"content:python:85.package-management.md","python/85.package-management.md","python/85.package-management",{"_path":781,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":782,"description":783,"slug":784,"parentId":735,"order":785,"_type":15,"_id":786,"_source":17,"_file":787,"_stem":788,"_extension":20},"/python/error-handling","Error Handling","Master Python error handling with try/except blocks, exception types, custom exceptions, debugging techniques, and best practices for robust application development","error-handling",86,"content:python:86.error-handling.md","python/86.error-handling.md","python/86.error-handling",{"_path":790,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":791,"description":792,"slug":793,"parentId":735,"order":794,"_type":15,"_id":795,"_source":17,"_file":796,"_stem":797,"_extension":20},"/python/getting-user-input","Getting User Input","Master user input handling in Python with input validation, data type conversion, interactive programs, and command-line interfaces for engaging user experiences","getting-user-input",87,"content:python:87.getting-user-input.md","python/87.getting-user-input.md","python/87.getting-user-input",{"_path":799,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":800,"description":801,"slug":802,"parentId":735,"order":803,"_type":15,"_id":804,"_source":17,"_file":805,"_stem":806,"_extension":20},"/python/text-formatting","Text Formatting","Master Python text formatting with f-strings, format methods, alignment, number formatting, and advanced techniques for professional, readable output","text-formatting",88,"content:python:88.text-formatting.md","python/88.text-formatting.md","python/88.text-formatting",{"_path":808,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":809,"description":810,"slug":811,"order":812,"isParent":13,"icon":14,"_type":15,"_id":813,"_source":17,"_file":814,"_stem":815,"_extension":20,"children":816},"/python/file-operations","File Operations","Master Python file handling with reading, writing, and managing files for data persistence and real-world applications","file-operations",89,"content:python:89.file-operations.md","python/89.file-operations.md","python/89.file-operations",[817,826,835,844],{"_path":818,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":819,"description":820,"slug":821,"parentId":808,"order":822,"_type":15,"_id":823,"_source":17,"_file":824,"_stem":825,"_extension":20},"/python/file-basics","File Basics","Learn fundamental Python file operations including opening files, understanding file modes, using context managers, and basic file handling concepts","file-basics",90,"content:python:90.file-basics.md","python/90.file-basics.md","python/90.file-basics",{"_path":827,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":828,"description":829,"slug":830,"parentId":808,"order":831,"_type":15,"_id":832,"_source":17,"_file":833,"_stem":834,"_extension":20},"/python/reading-files","Reading Files","Master Python file reading techniques including reading entire files, line-by-line processing, and handling different file formats for efficient data processing","reading-files",91,"content:python:91.reading-files.md","python/91.reading-files.md","python/91.reading-files",{"_path":836,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":837,"description":838,"slug":839,"parentId":808,"order":840,"_type":15,"_id":841,"_source":17,"_file":842,"_stem":843,"_extension":20},"/python/writing-files","Writing Files","Learn Python file writing techniques including creating new files, appending content, updating existing files, and saving different data formats safely","writing-files",92,"content:python:92.writing-files.md","python/92.writing-files.md","python/92.writing-files",{"_path":845,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":846,"description":847,"slug":848,"parentId":808,"order":849,"_type":15,"_id":850,"_source":17,"_file":851,"_stem":852,"_extension":20},"/python/file-management","File Management","Learn Python file management techniques including checking file properties, organizing files, directory operations, and implementing file system maintenance tasks","file-management",93,"content:python:93.file-management.md","python/93.file-management.md","python/93.file-management",{"_path":854,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":855,"description":856,"slug":857,"order":858,"isParent":13,"icon":14,"_type":15,"_id":859,"_source":17,"_file":860,"_stem":861,"_extension":20,"children":862},"/python/code-organization","Code Organization","Master Python code organization with modules, built-in libraries, and path management for creating maintainable and reusable applications","code-organization",94,"content:python:94.code-organization.md","python/94.code-organization.md","python/94.code-organization",[863,872,881],{"_path":864,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":865,"description":866,"slug":867,"parentId":854,"order":868,"_type":15,"_id":869,"_source":17,"_file":870,"_stem":871,"_extension":20},"/python/creating-modules","Creating Modules","Learn how to create custom Python modules, organize functions and classes, write reusable code components, and design effective module structures","creating-modules",95,"content:python:95.creating-modules.md","python/95.creating-modules.md","python/95.creating-modules",{"_path":873,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":874,"description":875,"slug":876,"parentId":854,"order":877,"_type":15,"_id":878,"_source":17,"_file":879,"_stem":880,"_extension":20},"/python/using-built-in-modules","Using Built-in Modules","Discover Python's extensive standard library and learn to effectively use built-in modules for common programming tasks, data processing, and system operations","using-built-in-modules",96,"content:python:96.using-built-in-modules.md","python/96.using-built-in-modules.md","python/96.using-built-in-modules",{"_path":882,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":883,"description":884,"slug":885,"parentId":854,"order":886,"_type":15,"_id":887,"_source":17,"_file":888,"_stem":889,"_extension":20},"/python/module-paths","Module Paths","Understand Python's module search system, manage import paths, work with packages, and organize larger projects with proper module path management","module-paths",97,"content:python:97.module-paths.md","python/97.module-paths.md","python/97.module-paths",{"_path":891,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":892,"description":893,"slug":894,"order":895,"isParent":13,"icon":14,"_type":15,"_id":896,"_source":17,"_file":897,"_stem":898,"_extension":20,"children":899,"expanded":13},"/python/reference-materials","Reference Materials","Comprehensive Python reference materials including reserved words, built-in functions, and operation guides for quick lookup and development support","reference-materials",98,"content:python:98.reference-materials.md","python/98.reference-materials.md","python/98.reference-materials",[900,909,918,927,936,945,953,961,970],{"_path":901,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":902,"description":903,"slug":904,"parentId":891,"order":905,"_type":15,"_id":906,"_source":17,"_file":907,"_stem":908,"_extension":20},"/python/reserved-words","Reserved Words","Complete reference of Python keywords and reserved words with descriptions, usage examples, and syntax guidelines","reserved-words",99,"content:python:99.reserved-words.md","python/99.reserved-words.md","python/99.reserved-words",{"_path":910,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":911,"description":912,"slug":913,"parentId":891,"order":914,"_type":15,"_id":915,"_source":17,"_file":916,"_stem":917,"_extension":20},"/python/built-in-functions","Built-in Functions","Comprehensive reference of Python's built-in functions with parameters, return values, and practical usage examples","built-in-functions",100,"content:python:100.built-in-functions.md","python/100.built-in-functions.md","python/100.built-in-functions",{"_path":919,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":920,"description":921,"slug":922,"parentId":891,"order":923,"_type":15,"_id":924,"_source":17,"_file":925,"_stem":926,"_extension":20},"/python/string-operations","String Operations","Complete reference of Python string methods, operations, and formatting techniques with examples and use cases","string-operations",101,"content:python:101.string-operations.md","python/101.string-operations.md","python/101.string-operations",{"_path":928,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":929,"description":930,"slug":931,"parentId":891,"order":932,"_type":15,"_id":933,"_source":17,"_file":934,"_stem":935,"_extension":20},"/python/list-operations","List Operations","Complete reference of Python list methods, operations, and manipulation techniques with examples and performance notes","list-operations",102,"content:python:102.list-operations.md","python/102.list-operations.md","python/102.list-operations",{"_path":937,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":938,"description":939,"slug":940,"parentId":891,"order":941,"_type":15,"_id":942,"_source":17,"_file":943,"_stem":944,"_extension":20},"/python/dictionary-operations","Dictionary Operations","Complete reference of Python dictionary methods, operations, and manipulation techniques with examples and use cases","dictionary-operations",103,"content:python:103.dictionary-operations.md","python/103.dictionary-operations.md","python/103.dictionary-operations",{"_path":946,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":435,"description":947,"slug":948,"parentId":891,"order":949,"_type":15,"_id":950,"_source":17,"_file":951,"_stem":952,"_extension":20},"/python/tuple-methods","Complete reference of Python tuple operations, methods, and techniques with examples and use cases","tuple-methods",104,"content:python:104.tuple-methods.md","python/104.tuple-methods.md","python/104.tuple-methods",{"_path":954,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":508,"description":955,"slug":956,"parentId":891,"order":957,"_type":15,"_id":958,"_source":17,"_file":959,"_stem":960,"_extension":20},"/python/set-methods","Complete reference of Python set operations, methods, and mathematical set operations with examples and use cases","set-methods",105,"content:python:105.set-methods.md","python/105.set-methods.md","python/105.set-methods",{"_path":962,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":963,"description":964,"slug":965,"parentId":891,"order":966,"_type":15,"_id":967,"_source":17,"_file":968,"_stem":969,"_extension":20},"/python/file-operations-reference","File Operations Reference","Complete reference of Python file operations, modes, methods, and file handling techniques with examples","file-operations-reference",106,"content:python:106.file-operations-reference.md","python/106.file-operations-reference.md","python/106.file-operations-reference",{"_path":971,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":972,"description":973,"slug":974,"parentId":891,"order":975,"_type":15,"_id":976,"_source":17,"_file":977,"_stem":978,"_extension":20},"/python/error-types","Error Types","Complete reference of Python exception types, error handling patterns, and debugging techniques with examples","error-types",107,"content:python:107.error-types.md","python/107.error-types.md","python/107.error-types",{"_path":980,"_dir":8,"_draft":7,"_partial":7,"_locale":8,"title":981,"description":10,"slug":982,"order":983,"icon":14,"_type":15,"_id":984,"_source":17,"_file":985,"_stem":986,"_extension":20},"/python","Introduction","python-tutorial",0,"content:python:index.md","python/index.md","python/index",[661],{"_path":662,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":663,"description":664,"slug":665,"parentId":607,"order":666,"body":989,"_type":15,"_id":667,"_source":17,"_file":668,"_stem":669,"_extension":20},{"type":990,"children":991,"toc":6063},"root",[992,1000,1006,1350,1357,1362,1369,1374,1582,1640,1646,1651,1657,1662,1948,1954,1959,2398,2404,2409,2415,2420,2839,2845,2850,2856,2861,2867,2872,3424,3430,3435,3441,3446,4067,4073,4078,4785,4791,4847,4853,5289,5345,5350,5629,5635,6004,6017,6023,6028,6035,6041,6046,6057],{"type":993,"tag":994,"props":995,"children":996},"element","h1",{"id":665},[997],{"type":998,"value":999},"text","🔄 Function Recursion",{"type":993,"tag":1001,"props":1002,"children":1003},"p",{},[1004],{"type":998,"value":1005},"Recursion is a programming technique where a function calls itself to solve smaller versions of the same problem. It's particularly powerful for problems that can be broken down into similar, simpler subproblems, offering elegant solutions to complex tasks.",{"type":993,"tag":1007,"props":1008,"children":1009},"code-try",{},[1010],{"type":993,"tag":1011,"props":1012,"children":1015},"pre",{"className":1013,"code":1014,"language":6,"meta":8,"style":8},"language-python shiki shiki-themes github-light github-dark","# Classic recursion example: factorial calculation\ndef factorial(n):\n    \"\"\"Calculate factorial using recursion\"\"\"\n    # Base case: stop the recursion\n    if n \u003C= 1:\n        return 1\n    \n    # Recursive case: n! = n * (n-1)!\n    return n * factorial(n - 1)\n\n# Calculate factorials\nprint(f\"5! = {factorial(5)}\")  # 5 * 4 * 3 * 2 * 1 = 120\nprint(f\"3! = {factorial(3)}\")  # 3 * 2 * 1 = 6\nprint(f\"0! = {factorial(0)}\")  # Base case = 1\n",[1016],{"type":993,"tag":1017,"props":1018,"children":1019},"code",{"__ignoreMap":8},[1020,1031,1052,1061,1069,1098,1111,1119,1127,1163,1171,1179,1242,1296],{"type":993,"tag":1021,"props":1022,"children":1024},"span",{"class":1023,"line":12},"line",[1025],{"type":993,"tag":1021,"props":1026,"children":1028},{"style":1027},"--shiki-default:#6A737D;--shiki-app-dark-mode:#6A737D",[1029],{"type":998,"value":1030},"# Classic recursion example: factorial calculation\n",{"type":993,"tag":1021,"props":1032,"children":1033},{"class":1023,"line":27},[1034,1040,1046],{"type":993,"tag":1021,"props":1035,"children":1037},{"style":1036},"--shiki-default:#D73A49;--shiki-app-dark-mode:#F97583",[1038],{"type":998,"value":1039},"def",{"type":993,"tag":1021,"props":1041,"children":1043},{"style":1042},"--shiki-default:#6F42C1;--shiki-app-dark-mode:#B392F0",[1044],{"type":998,"value":1045}," factorial",{"type":993,"tag":1021,"props":1047,"children":1049},{"style":1048},"--shiki-default:#24292E;--shiki-app-dark-mode:#E1E4E8",[1050],{"type":998,"value":1051},"(n):\n",{"type":993,"tag":1021,"props":1053,"children":1054},{"class":1023,"line":36},[1055],{"type":993,"tag":1021,"props":1056,"children":1058},{"style":1057},"--shiki-default:#032F62;--shiki-app-dark-mode:#9ECBFF",[1059],{"type":998,"value":1060},"    \"\"\"Calculate factorial using recursion\"\"\"\n",{"type":993,"tag":1021,"props":1062,"children":1063},{"class":1023,"line":45},[1064],{"type":993,"tag":1021,"props":1065,"children":1066},{"style":1027},[1067],{"type":998,"value":1068},"    # Base case: stop the recursion\n",{"type":993,"tag":1021,"props":1070,"children":1071},{"class":1023,"line":54},[1072,1077,1082,1087,1093],{"type":993,"tag":1021,"props":1073,"children":1074},{"style":1036},[1075],{"type":998,"value":1076},"    if",{"type":993,"tag":1021,"props":1078,"children":1079},{"style":1048},[1080],{"type":998,"value":1081}," n ",{"type":993,"tag":1021,"props":1083,"children":1084},{"style":1036},[1085],{"type":998,"value":1086},"\u003C=",{"type":993,"tag":1021,"props":1088,"children":1090},{"style":1089},"--shiki-default:#005CC5;--shiki-app-dark-mode:#79B8FF",[1091],{"type":998,"value":1092}," 1",{"type":993,"tag":1021,"props":1094,"children":1095},{"style":1048},[1096],{"type":998,"value":1097},":\n",{"type":993,"tag":1021,"props":1099,"children":1100},{"class":1023,"line":63},[1101,1106],{"type":993,"tag":1021,"props":1102,"children":1103},{"style":1036},[1104],{"type":998,"value":1105},"        return",{"type":993,"tag":1021,"props":1107,"children":1108},{"style":1089},[1109],{"type":998,"value":1110}," 1\n",{"type":993,"tag":1021,"props":1112,"children":1113},{"class":1023,"line":72},[1114],{"type":993,"tag":1021,"props":1115,"children":1116},{"style":1048},[1117],{"type":998,"value":1118},"    \n",{"type":993,"tag":1021,"props":1120,"children":1121},{"class":1023,"line":81},[1122],{"type":993,"tag":1021,"props":1123,"children":1124},{"style":1027},[1125],{"type":998,"value":1126},"    # Recursive case: n! = n * (n-1)!\n",{"type":993,"tag":1021,"props":1128,"children":1129},{"class":1023,"line":91},[1130,1135,1139,1144,1149,1154,1158],{"type":993,"tag":1021,"props":1131,"children":1132},{"style":1036},[1133],{"type":998,"value":1134},"    return",{"type":993,"tag":1021,"props":1136,"children":1137},{"style":1048},[1138],{"type":998,"value":1081},{"type":993,"tag":1021,"props":1140,"children":1141},{"style":1036},[1142],{"type":998,"value":1143},"*",{"type":993,"tag":1021,"props":1145,"children":1146},{"style":1048},[1147],{"type":998,"value":1148}," factorial(n ",{"type":993,"tag":1021,"props":1150,"children":1151},{"style":1036},[1152],{"type":998,"value":1153},"-",{"type":993,"tag":1021,"props":1155,"children":1156},{"style":1089},[1157],{"type":998,"value":1092},{"type":993,"tag":1021,"props":1159,"children":1160},{"style":1048},[1161],{"type":998,"value":1162},")\n",{"type":993,"tag":1021,"props":1164,"children":1165},{"class":1023,"line":100},[1166],{"type":993,"tag":1021,"props":1167,"children":1168},{"emptyLinePlaceholder":13},[1169],{"type":998,"value":1170},"\n",{"type":993,"tag":1021,"props":1172,"children":1173},{"class":1023,"line":109},[1174],{"type":993,"tag":1021,"props":1175,"children":1176},{"style":1027},[1177],{"type":998,"value":1178},"# Calculate factorials\n",{"type":993,"tag":1021,"props":1180,"children":1181},{"class":1023,"line":118},[1182,1187,1192,1197,1202,1207,1212,1217,1222,1227,1232,1237],{"type":993,"tag":1021,"props":1183,"children":1184},{"style":1089},[1185],{"type":998,"value":1186},"print",{"type":993,"tag":1021,"props":1188,"children":1189},{"style":1048},[1190],{"type":998,"value":1191},"(",{"type":993,"tag":1021,"props":1193,"children":1194},{"style":1036},[1195],{"type":998,"value":1196},"f",{"type":993,"tag":1021,"props":1198,"children":1199},{"style":1057},[1200],{"type":998,"value":1201},"\"5! = ",{"type":993,"tag":1021,"props":1203,"children":1204},{"style":1089},[1205],{"type":998,"value":1206},"{",{"type":993,"tag":1021,"props":1208,"children":1209},{"style":1048},[1210],{"type":998,"value":1211},"factorial(",{"type":993,"tag":1021,"props":1213,"children":1214},{"style":1089},[1215],{"type":998,"value":1216},"5",{"type":993,"tag":1021,"props":1218,"children":1219},{"style":1048},[1220],{"type":998,"value":1221},")",{"type":993,"tag":1021,"props":1223,"children":1224},{"style":1089},[1225],{"type":998,"value":1226},"}",{"type":993,"tag":1021,"props":1228,"children":1229},{"style":1057},[1230],{"type":998,"value":1231},"\"",{"type":993,"tag":1021,"props":1233,"children":1234},{"style":1048},[1235],{"type":998,"value":1236},")  ",{"type":993,"tag":1021,"props":1238,"children":1239},{"style":1027},[1240],{"type":998,"value":1241},"# 5 * 4 * 3 * 2 * 1 = 120\n",{"type":993,"tag":1021,"props":1243,"children":1244},{"class":1023,"line":127},[1245,1249,1253,1257,1262,1266,1270,1275,1279,1283,1287,1291],{"type":993,"tag":1021,"props":1246,"children":1247},{"style":1089},[1248],{"type":998,"value":1186},{"type":993,"tag":1021,"props":1250,"children":1251},{"style":1048},[1252],{"type":998,"value":1191},{"type":993,"tag":1021,"props":1254,"children":1255},{"style":1036},[1256],{"type":998,"value":1196},{"type":993,"tag":1021,"props":1258,"children":1259},{"style":1057},[1260],{"type":998,"value":1261},"\"3! = ",{"type":993,"tag":1021,"props":1263,"children":1264},{"style":1089},[1265],{"type":998,"value":1206},{"type":993,"tag":1021,"props":1267,"children":1268},{"style":1048},[1269],{"type":998,"value":1211},{"type":993,"tag":1021,"props":1271,"children":1272},{"style":1089},[1273],{"type":998,"value":1274},"3",{"type":993,"tag":1021,"props":1276,"children":1277},{"style":1048},[1278],{"type":998,"value":1221},{"type":993,"tag":1021,"props":1280,"children":1281},{"style":1089},[1282],{"type":998,"value":1226},{"type":993,"tag":1021,"props":1284,"children":1285},{"style":1057},[1286],{"type":998,"value":1231},{"type":993,"tag":1021,"props":1288,"children":1289},{"style":1048},[1290],{"type":998,"value":1236},{"type":993,"tag":1021,"props":1292,"children":1293},{"style":1027},[1294],{"type":998,"value":1295},"# 3 * 2 * 1 = 6\n",{"type":993,"tag":1021,"props":1297,"children":1298},{"class":1023,"line":136},[1299,1303,1307,1311,1316,1320,1324,1329,1333,1337,1341,1345],{"type":993,"tag":1021,"props":1300,"children":1301},{"style":1089},[1302],{"type":998,"value":1186},{"type":993,"tag":1021,"props":1304,"children":1305},{"style":1048},[1306],{"type":998,"value":1191},{"type":993,"tag":1021,"props":1308,"children":1309},{"style":1036},[1310],{"type":998,"value":1196},{"type":993,"tag":1021,"props":1312,"children":1313},{"style":1057},[1314],{"type":998,"value":1315},"\"0! = ",{"type":993,"tag":1021,"props":1317,"children":1318},{"style":1089},[1319],{"type":998,"value":1206},{"type":993,"tag":1021,"props":1321,"children":1322},{"style":1048},[1323],{"type":998,"value":1211},{"type":993,"tag":1021,"props":1325,"children":1326},{"style":1089},[1327],{"type":998,"value":1328},"0",{"type":993,"tag":1021,"props":1330,"children":1331},{"style":1048},[1332],{"type":998,"value":1221},{"type":993,"tag":1021,"props":1334,"children":1335},{"style":1089},[1336],{"type":998,"value":1226},{"type":993,"tag":1021,"props":1338,"children":1339},{"style":1057},[1340],{"type":998,"value":1231},{"type":993,"tag":1021,"props":1342,"children":1343},{"style":1048},[1344],{"type":998,"value":1236},{"type":993,"tag":1021,"props":1346,"children":1347},{"style":1027},[1348],{"type":998,"value":1349},"# Base case = 1\n",{"type":993,"tag":1351,"props":1352,"children":1354},"h2",{"id":1353},"understanding-recursion",[1355],{"type":998,"value":1356},"🎯 Understanding Recursion",{"type":993,"tag":1001,"props":1358,"children":1359},{},[1360],{"type":998,"value":1361},"Recursion works by breaking a problem into smaller, identical subproblems until reaching a simple case that can be solved directly. Each recursive call works on a smaller piece of the original problem.",{"type":993,"tag":1363,"props":1364,"children":1366},"h3",{"id":1365},"base-case-and-recursive-case",[1367],{"type":998,"value":1368},"Base Case and Recursive Case",{"type":993,"tag":1001,"props":1370,"children":1371},{},[1372],{"type":998,"value":1373},"Every recursive function needs a base case to stop the recursion and a recursive case that calls the function with modified parameters.",{"type":993,"tag":1007,"props":1375,"children":1376},{},[1377],{"type":993,"tag":1011,"props":1378,"children":1380},{"className":1013,"code":1379,"language":6,"meta":8,"style":8},"def countdown(n):\n    \"\"\"Countdown from n to 1 using recursion\"\"\"\n    # Base case: stop when we reach 0\n    if n \u003C= 0:\n        print(\"Blast off!\")\n        return\n    \n    # Recursive case: print current number and continue\n    print(f\"{n}...\")\n    countdown(n - 1)  # Call with smaller value\n\n# Start countdown\ncountdown(5)\n",[1381],{"type":993,"tag":1017,"props":1382,"children":1383},{"__ignoreMap":8},[1384,1400,1408,1416,1440,1461,1469,1476,1484,1526,1551,1558,1566],{"type":993,"tag":1021,"props":1385,"children":1386},{"class":1023,"line":12},[1387,1391,1396],{"type":993,"tag":1021,"props":1388,"children":1389},{"style":1036},[1390],{"type":998,"value":1039},{"type":993,"tag":1021,"props":1392,"children":1393},{"style":1042},[1394],{"type":998,"value":1395}," countdown",{"type":993,"tag":1021,"props":1397,"children":1398},{"style":1048},[1399],{"type":998,"value":1051},{"type":993,"tag":1021,"props":1401,"children":1402},{"class":1023,"line":27},[1403],{"type":993,"tag":1021,"props":1404,"children":1405},{"style":1057},[1406],{"type":998,"value":1407},"    \"\"\"Countdown from n to 1 using recursion\"\"\"\n",{"type":993,"tag":1021,"props":1409,"children":1410},{"class":1023,"line":36},[1411],{"type":993,"tag":1021,"props":1412,"children":1413},{"style":1027},[1414],{"type":998,"value":1415},"    # Base case: stop when we reach 0\n",{"type":993,"tag":1021,"props":1417,"children":1418},{"class":1023,"line":45},[1419,1423,1427,1431,1436],{"type":993,"tag":1021,"props":1420,"children":1421},{"style":1036},[1422],{"type":998,"value":1076},{"type":993,"tag":1021,"props":1424,"children":1425},{"style":1048},[1426],{"type":998,"value":1081},{"type":993,"tag":1021,"props":1428,"children":1429},{"style":1036},[1430],{"type":998,"value":1086},{"type":993,"tag":1021,"props":1432,"children":1433},{"style":1089},[1434],{"type":998,"value":1435}," 0",{"type":993,"tag":1021,"props":1437,"children":1438},{"style":1048},[1439],{"type":998,"value":1097},{"type":993,"tag":1021,"props":1441,"children":1442},{"class":1023,"line":54},[1443,1448,1452,1457],{"type":993,"tag":1021,"props":1444,"children":1445},{"style":1089},[1446],{"type":998,"value":1447},"        print",{"type":993,"tag":1021,"props":1449,"children":1450},{"style":1048},[1451],{"type":998,"value":1191},{"type":993,"tag":1021,"props":1453,"children":1454},{"style":1057},[1455],{"type":998,"value":1456},"\"Blast off!\"",{"type":993,"tag":1021,"props":1458,"children":1459},{"style":1048},[1460],{"type":998,"value":1162},{"type":993,"tag":1021,"props":1462,"children":1463},{"class":1023,"line":63},[1464],{"type":993,"tag":1021,"props":1465,"children":1466},{"style":1036},[1467],{"type":998,"value":1468},"        return\n",{"type":993,"tag":1021,"props":1470,"children":1471},{"class":1023,"line":72},[1472],{"type":993,"tag":1021,"props":1473,"children":1474},{"style":1048},[1475],{"type":998,"value":1118},{"type":993,"tag":1021,"props":1477,"children":1478},{"class":1023,"line":81},[1479],{"type":993,"tag":1021,"props":1480,"children":1481},{"style":1027},[1482],{"type":998,"value":1483},"    # Recursive case: print current number and continue\n",{"type":993,"tag":1021,"props":1485,"children":1486},{"class":1023,"line":91},[1487,1492,1496,1500,1504,1508,1513,1517,1522],{"type":993,"tag":1021,"props":1488,"children":1489},{"style":1089},[1490],{"type":998,"value":1491},"    print",{"type":993,"tag":1021,"props":1493,"children":1494},{"style":1048},[1495],{"type":998,"value":1191},{"type":993,"tag":1021,"props":1497,"children":1498},{"style":1036},[1499],{"type":998,"value":1196},{"type":993,"tag":1021,"props":1501,"children":1502},{"style":1057},[1503],{"type":998,"value":1231},{"type":993,"tag":1021,"props":1505,"children":1506},{"style":1089},[1507],{"type":998,"value":1206},{"type":993,"tag":1021,"props":1509,"children":1510},{"style":1048},[1511],{"type":998,"value":1512},"n",{"type":993,"tag":1021,"props":1514,"children":1515},{"style":1089},[1516],{"type":998,"value":1226},{"type":993,"tag":1021,"props":1518,"children":1519},{"style":1057},[1520],{"type":998,"value":1521},"...\"",{"type":993,"tag":1021,"props":1523,"children":1524},{"style":1048},[1525],{"type":998,"value":1162},{"type":993,"tag":1021,"props":1527,"children":1528},{"class":1023,"line":100},[1529,1534,1538,1542,1546],{"type":993,"tag":1021,"props":1530,"children":1531},{"style":1048},[1532],{"type":998,"value":1533},"    countdown(n ",{"type":993,"tag":1021,"props":1535,"children":1536},{"style":1036},[1537],{"type":998,"value":1153},{"type":993,"tag":1021,"props":1539,"children":1540},{"style":1089},[1541],{"type":998,"value":1092},{"type":993,"tag":1021,"props":1543,"children":1544},{"style":1048},[1545],{"type":998,"value":1236},{"type":993,"tag":1021,"props":1547,"children":1548},{"style":1027},[1549],{"type":998,"value":1550},"# Call with smaller value\n",{"type":993,"tag":1021,"props":1552,"children":1553},{"class":1023,"line":109},[1554],{"type":993,"tag":1021,"props":1555,"children":1556},{"emptyLinePlaceholder":13},[1557],{"type":998,"value":1170},{"type":993,"tag":1021,"props":1559,"children":1560},{"class":1023,"line":118},[1561],{"type":993,"tag":1021,"props":1562,"children":1563},{"style":1027},[1564],{"type":998,"value":1565},"# Start countdown\n",{"type":993,"tag":1021,"props":1567,"children":1568},{"class":1023,"line":127},[1569,1574,1578],{"type":993,"tag":1021,"props":1570,"children":1571},{"style":1048},[1572],{"type":998,"value":1573},"countdown(",{"type":993,"tag":1021,"props":1575,"children":1576},{"style":1089},[1577],{"type":998,"value":1216},{"type":993,"tag":1021,"props":1579,"children":1580},{"style":1048},[1581],{"type":998,"value":1162},{"type":993,"tag":1583,"props":1584,"children":1588},"info-box",{"emoji":1585,"title":1586,"type":1587},"🔄","Recursion Components","info",[1589,1600,1610,1620,1630],{"type":993,"tag":1001,"props":1590,"children":1591},{},[1592,1598],{"type":993,"tag":1593,"props":1594,"children":1595},"strong",{},[1596],{"type":998,"value":1597},"Base Case:",{"type":998,"value":1599}," The condition that stops recursion - crucial to prevent infinite loops.",{"type":993,"tag":1001,"props":1601,"children":1602},{},[1603,1608],{"type":993,"tag":1593,"props":1604,"children":1605},{},[1606],{"type":998,"value":1607},"Recursive Case:",{"type":998,"value":1609}," The function calls itself with modified parameters moving toward the base case.",{"type":993,"tag":1001,"props":1611,"children":1612},{},[1613,1618],{"type":993,"tag":1593,"props":1614,"children":1615},{},[1616],{"type":998,"value":1617},"Progress:",{"type":998,"value":1619}," Each recursive call must make progress toward the base case.",{"type":993,"tag":1001,"props":1621,"children":1622},{},[1623,1628],{"type":993,"tag":1593,"props":1624,"children":1625},{},[1626],{"type":998,"value":1627},"Return Values:",{"type":998,"value":1629}," Recursive functions often combine results from recursive calls.",{"type":993,"tag":1001,"props":1631,"children":1632},{},[1633,1638],{"type":993,"tag":1593,"props":1634,"children":1635},{},[1636],{"type":998,"value":1637},"Stack Management:",{"type":998,"value":1639}," Each function call uses memory - deep recursion can cause stack overflow.",{"type":993,"tag":1351,"props":1641,"children":1643},{"id":1642},"classic-recursive-problems",[1644],{"type":998,"value":1645},"⚡ Classic Recursive Problems",{"type":993,"tag":1001,"props":1647,"children":1648},{},[1649],{"type":998,"value":1650},"Certain problems naturally fit recursive solutions, where the structure of the problem mirrors the recursive approach.",{"type":993,"tag":1363,"props":1652,"children":1654},{"id":1653},"fibonacci-sequence",[1655],{"type":998,"value":1656},"Fibonacci Sequence",{"type":993,"tag":1001,"props":1658,"children":1659},{},[1660],{"type":998,"value":1661},"The Fibonacci sequence demonstrates recursion where each number is the sum of the two preceding numbers.",{"type":993,"tag":1007,"props":1663,"children":1664},{},[1665],{"type":993,"tag":1011,"props":1666,"children":1668},{"className":1013,"code":1667,"language":6,"meta":8,"style":8},"def fibonacci(n):\n    \"\"\"Calculate nth Fibonacci number recursively\"\"\"\n    # Base cases\n    if n \u003C= 0:\n        return 0\n    elif n == 1:\n        return 1\n    \n    # Recursive case: F(n) = F(n-1) + F(n-2)\n    return fibonacci(n - 1) + fibonacci(n - 2)\n\n# Generate Fibonacci sequence\nfor i in range(8):\n    print(f\"F({i}) = {fibonacci(i)}\")\n",[1669],{"type":993,"tag":1017,"props":1670,"children":1671},{"__ignoreMap":8},[1672,1688,1696,1704,1727,1739,1764,1775,1782,1790,1837,1844,1852,1889],{"type":993,"tag":1021,"props":1673,"children":1674},{"class":1023,"line":12},[1675,1679,1684],{"type":993,"tag":1021,"props":1676,"children":1677},{"style":1036},[1678],{"type":998,"value":1039},{"type":993,"tag":1021,"props":1680,"children":1681},{"style":1042},[1682],{"type":998,"value":1683}," fibonacci",{"type":993,"tag":1021,"props":1685,"children":1686},{"style":1048},[1687],{"type":998,"value":1051},{"type":993,"tag":1021,"props":1689,"children":1690},{"class":1023,"line":27},[1691],{"type":993,"tag":1021,"props":1692,"children":1693},{"style":1057},[1694],{"type":998,"value":1695},"    \"\"\"Calculate nth Fibonacci number recursively\"\"\"\n",{"type":993,"tag":1021,"props":1697,"children":1698},{"class":1023,"line":36},[1699],{"type":993,"tag":1021,"props":1700,"children":1701},{"style":1027},[1702],{"type":998,"value":1703},"    # Base cases\n",{"type":993,"tag":1021,"props":1705,"children":1706},{"class":1023,"line":45},[1707,1711,1715,1719,1723],{"type":993,"tag":1021,"props":1708,"children":1709},{"style":1036},[1710],{"type":998,"value":1076},{"type":993,"tag":1021,"props":1712,"children":1713},{"style":1048},[1714],{"type":998,"value":1081},{"type":993,"tag":1021,"props":1716,"children":1717},{"style":1036},[1718],{"type":998,"value":1086},{"type":993,"tag":1021,"props":1720,"children":1721},{"style":1089},[1722],{"type":998,"value":1435},{"type":993,"tag":1021,"props":1724,"children":1725},{"style":1048},[1726],{"type":998,"value":1097},{"type":993,"tag":1021,"props":1728,"children":1729},{"class":1023,"line":54},[1730,1734],{"type":993,"tag":1021,"props":1731,"children":1732},{"style":1036},[1733],{"type":998,"value":1105},{"type":993,"tag":1021,"props":1735,"children":1736},{"style":1089},[1737],{"type":998,"value":1738}," 0\n",{"type":993,"tag":1021,"props":1740,"children":1741},{"class":1023,"line":63},[1742,1747,1751,1756,1760],{"type":993,"tag":1021,"props":1743,"children":1744},{"style":1036},[1745],{"type":998,"value":1746},"    elif",{"type":993,"tag":1021,"props":1748,"children":1749},{"style":1048},[1750],{"type":998,"value":1081},{"type":993,"tag":1021,"props":1752,"children":1753},{"style":1036},[1754],{"type":998,"value":1755},"==",{"type":993,"tag":1021,"props":1757,"children":1758},{"style":1089},[1759],{"type":998,"value":1092},{"type":993,"tag":1021,"props":1761,"children":1762},{"style":1048},[1763],{"type":998,"value":1097},{"type":993,"tag":1021,"props":1765,"children":1766},{"class":1023,"line":72},[1767,1771],{"type":993,"tag":1021,"props":1768,"children":1769},{"style":1036},[1770],{"type":998,"value":1105},{"type":993,"tag":1021,"props":1772,"children":1773},{"style":1089},[1774],{"type":998,"value":1110},{"type":993,"tag":1021,"props":1776,"children":1777},{"class":1023,"line":81},[1778],{"type":993,"tag":1021,"props":1779,"children":1780},{"style":1048},[1781],{"type":998,"value":1118},{"type":993,"tag":1021,"props":1783,"children":1784},{"class":1023,"line":91},[1785],{"type":993,"tag":1021,"props":1786,"children":1787},{"style":1027},[1788],{"type":998,"value":1789},"    # Recursive case: F(n) = F(n-1) + F(n-2)\n",{"type":993,"tag":1021,"props":1791,"children":1792},{"class":1023,"line":100},[1793,1797,1802,1806,1810,1815,1820,1824,1828,1833],{"type":993,"tag":1021,"props":1794,"children":1795},{"style":1036},[1796],{"type":998,"value":1134},{"type":993,"tag":1021,"props":1798,"children":1799},{"style":1048},[1800],{"type":998,"value":1801}," fibonacci(n ",{"type":993,"tag":1021,"props":1803,"children":1804},{"style":1036},[1805],{"type":998,"value":1153},{"type":993,"tag":1021,"props":1807,"children":1808},{"style":1089},[1809],{"type":998,"value":1092},{"type":993,"tag":1021,"props":1811,"children":1812},{"style":1048},[1813],{"type":998,"value":1814},") ",{"type":993,"tag":1021,"props":1816,"children":1817},{"style":1036},[1818],{"type":998,"value":1819},"+",{"type":993,"tag":1021,"props":1821,"children":1822},{"style":1048},[1823],{"type":998,"value":1801},{"type":993,"tag":1021,"props":1825,"children":1826},{"style":1036},[1827],{"type":998,"value":1153},{"type":993,"tag":1021,"props":1829,"children":1830},{"style":1089},[1831],{"type":998,"value":1832}," 2",{"type":993,"tag":1021,"props":1834,"children":1835},{"style":1048},[1836],{"type":998,"value":1162},{"type":993,"tag":1021,"props":1838,"children":1839},{"class":1023,"line":109},[1840],{"type":993,"tag":1021,"props":1841,"children":1842},{"emptyLinePlaceholder":13},[1843],{"type":998,"value":1170},{"type":993,"tag":1021,"props":1845,"children":1846},{"class":1023,"line":118},[1847],{"type":993,"tag":1021,"props":1848,"children":1849},{"style":1027},[1850],{"type":998,"value":1851},"# Generate Fibonacci sequence\n",{"type":993,"tag":1021,"props":1853,"children":1854},{"class":1023,"line":127},[1855,1860,1865,1870,1875,1879,1884],{"type":993,"tag":1021,"props":1856,"children":1857},{"style":1036},[1858],{"type":998,"value":1859},"for",{"type":993,"tag":1021,"props":1861,"children":1862},{"style":1048},[1863],{"type":998,"value":1864}," i ",{"type":993,"tag":1021,"props":1866,"children":1867},{"style":1036},[1868],{"type":998,"value":1869},"in",{"type":993,"tag":1021,"props":1871,"children":1872},{"style":1089},[1873],{"type":998,"value":1874}," range",{"type":993,"tag":1021,"props":1876,"children":1877},{"style":1048},[1878],{"type":998,"value":1191},{"type":993,"tag":1021,"props":1880,"children":1881},{"style":1089},[1882],{"type":998,"value":1883},"8",{"type":993,"tag":1021,"props":1885,"children":1886},{"style":1048},[1887],{"type":998,"value":1888},"):\n",{"type":993,"tag":1021,"props":1890,"children":1891},{"class":1023,"line":136},[1892,1896,1900,1904,1909,1913,1918,1922,1927,1931,1936,1940,1944],{"type":993,"tag":1021,"props":1893,"children":1894},{"style":1089},[1895],{"type":998,"value":1491},{"type":993,"tag":1021,"props":1897,"children":1898},{"style":1048},[1899],{"type":998,"value":1191},{"type":993,"tag":1021,"props":1901,"children":1902},{"style":1036},[1903],{"type":998,"value":1196},{"type":993,"tag":1021,"props":1905,"children":1906},{"style":1057},[1907],{"type":998,"value":1908},"\"F(",{"type":993,"tag":1021,"props":1910,"children":1911},{"style":1089},[1912],{"type":998,"value":1206},{"type":993,"tag":1021,"props":1914,"children":1915},{"style":1048},[1916],{"type":998,"value":1917},"i",{"type":993,"tag":1021,"props":1919,"children":1920},{"style":1089},[1921],{"type":998,"value":1226},{"type":993,"tag":1021,"props":1923,"children":1924},{"style":1057},[1925],{"type":998,"value":1926},") = ",{"type":993,"tag":1021,"props":1928,"children":1929},{"style":1089},[1930],{"type":998,"value":1206},{"type":993,"tag":1021,"props":1932,"children":1933},{"style":1048},[1934],{"type":998,"value":1935},"fibonacci(i)",{"type":993,"tag":1021,"props":1937,"children":1938},{"style":1089},[1939],{"type":998,"value":1226},{"type":993,"tag":1021,"props":1941,"children":1942},{"style":1057},[1943],{"type":998,"value":1231},{"type":993,"tag":1021,"props":1945,"children":1946},{"style":1048},[1947],{"type":998,"value":1162},{"type":993,"tag":1363,"props":1949,"children":1951},{"id":1950},"sum-of-list-elements",[1952],{"type":998,"value":1953},"Sum of List Elements",{"type":993,"tag":1001,"props":1955,"children":1956},{},[1957],{"type":998,"value":1958},"Recursive functions can elegantly process data structures by handling one element and recursing on the remainder.",{"type":993,"tag":1007,"props":1960,"children":1961},{},[1962],{"type":993,"tag":1011,"props":1963,"children":1965},{"className":1013,"code":1964,"language":6,"meta":8,"style":8},"def recursive_sum(numbers):\n    \"\"\"Calculate sum of list elements recursively\"\"\"\n    # Base case: empty list\n    if not numbers:\n        return 0\n    \n    # Recursive case: first element + sum of rest\n    return numbers[0] + recursive_sum(numbers[1:])\n\ndef find_maximum(numbers):\n    \"\"\"Find maximum value in list recursively\"\"\"\n    # Base case: single element\n    if len(numbers) == 1:\n        return numbers[0]\n    \n    # Recursive case: max of first vs max of rest\n    max_of_rest = find_maximum(numbers[1:])\n    return max(numbers[0], max_of_rest)\n\n# Test recursive functions\ndata = [3, 7, 2, 9, 1]\nprint(f\"Sum: {recursive_sum(data)}\")\nprint(f\"Maximum: {find_maximum(data)}\")\n",[1966],{"type":993,"tag":1017,"props":1967,"children":1968},{"__ignoreMap":8},[1969,1986,1994,2002,2019,2030,2037,2045,2085,2092,2108,2116,2124,2153,2173,2180,2188,2214,2240,2247,2255,2316,2357],{"type":993,"tag":1021,"props":1970,"children":1971},{"class":1023,"line":12},[1972,1976,1981],{"type":993,"tag":1021,"props":1973,"children":1974},{"style":1036},[1975],{"type":998,"value":1039},{"type":993,"tag":1021,"props":1977,"children":1978},{"style":1042},[1979],{"type":998,"value":1980}," recursive_sum",{"type":993,"tag":1021,"props":1982,"children":1983},{"style":1048},[1984],{"type":998,"value":1985},"(numbers):\n",{"type":993,"tag":1021,"props":1987,"children":1988},{"class":1023,"line":27},[1989],{"type":993,"tag":1021,"props":1990,"children":1991},{"style":1057},[1992],{"type":998,"value":1993},"    \"\"\"Calculate sum of list elements recursively\"\"\"\n",{"type":993,"tag":1021,"props":1995,"children":1996},{"class":1023,"line":36},[1997],{"type":993,"tag":1021,"props":1998,"children":1999},{"style":1027},[2000],{"type":998,"value":2001},"    # Base case: empty list\n",{"type":993,"tag":1021,"props":2003,"children":2004},{"class":1023,"line":45},[2005,2009,2014],{"type":993,"tag":1021,"props":2006,"children":2007},{"style":1036},[2008],{"type":998,"value":1076},{"type":993,"tag":1021,"props":2010,"children":2011},{"style":1036},[2012],{"type":998,"value":2013}," not",{"type":993,"tag":1021,"props":2015,"children":2016},{"style":1048},[2017],{"type":998,"value":2018}," numbers:\n",{"type":993,"tag":1021,"props":2020,"children":2021},{"class":1023,"line":54},[2022,2026],{"type":993,"tag":1021,"props":2023,"children":2024},{"style":1036},[2025],{"type":998,"value":1105},{"type":993,"tag":1021,"props":2027,"children":2028},{"style":1089},[2029],{"type":998,"value":1738},{"type":993,"tag":1021,"props":2031,"children":2032},{"class":1023,"line":63},[2033],{"type":993,"tag":1021,"props":2034,"children":2035},{"style":1048},[2036],{"type":998,"value":1118},{"type":993,"tag":1021,"props":2038,"children":2039},{"class":1023,"line":72},[2040],{"type":993,"tag":1021,"props":2041,"children":2042},{"style":1027},[2043],{"type":998,"value":2044},"    # Recursive case: first element + sum of rest\n",{"type":993,"tag":1021,"props":2046,"children":2047},{"class":1023,"line":81},[2048,2052,2057,2061,2066,2070,2075,2080],{"type":993,"tag":1021,"props":2049,"children":2050},{"style":1036},[2051],{"type":998,"value":1134},{"type":993,"tag":1021,"props":2053,"children":2054},{"style":1048},[2055],{"type":998,"value":2056}," numbers[",{"type":993,"tag":1021,"props":2058,"children":2059},{"style":1089},[2060],{"type":998,"value":1328},{"type":993,"tag":1021,"props":2062,"children":2063},{"style":1048},[2064],{"type":998,"value":2065},"] ",{"type":993,"tag":1021,"props":2067,"children":2068},{"style":1036},[2069],{"type":998,"value":1819},{"type":993,"tag":1021,"props":2071,"children":2072},{"style":1048},[2073],{"type":998,"value":2074}," recursive_sum(numbers[",{"type":993,"tag":1021,"props":2076,"children":2077},{"style":1089},[2078],{"type":998,"value":2079},"1",{"type":993,"tag":1021,"props":2081,"children":2082},{"style":1048},[2083],{"type":998,"value":2084},":])\n",{"type":993,"tag":1021,"props":2086,"children":2087},{"class":1023,"line":91},[2088],{"type":993,"tag":1021,"props":2089,"children":2090},{"emptyLinePlaceholder":13},[2091],{"type":998,"value":1170},{"type":993,"tag":1021,"props":2093,"children":2094},{"class":1023,"line":100},[2095,2099,2104],{"type":993,"tag":1021,"props":2096,"children":2097},{"style":1036},[2098],{"type":998,"value":1039},{"type":993,"tag":1021,"props":2100,"children":2101},{"style":1042},[2102],{"type":998,"value":2103}," find_maximum",{"type":993,"tag":1021,"props":2105,"children":2106},{"style":1048},[2107],{"type":998,"value":1985},{"type":993,"tag":1021,"props":2109,"children":2110},{"class":1023,"line":109},[2111],{"type":993,"tag":1021,"props":2112,"children":2113},{"style":1057},[2114],{"type":998,"value":2115},"    \"\"\"Find maximum value in list recursively\"\"\"\n",{"type":993,"tag":1021,"props":2117,"children":2118},{"class":1023,"line":118},[2119],{"type":993,"tag":1021,"props":2120,"children":2121},{"style":1027},[2122],{"type":998,"value":2123},"    # Base case: single element\n",{"type":993,"tag":1021,"props":2125,"children":2126},{"class":1023,"line":127},[2127,2131,2136,2141,2145,2149],{"type":993,"tag":1021,"props":2128,"children":2129},{"style":1036},[2130],{"type":998,"value":1076},{"type":993,"tag":1021,"props":2132,"children":2133},{"style":1089},[2134],{"type":998,"value":2135}," len",{"type":993,"tag":1021,"props":2137,"children":2138},{"style":1048},[2139],{"type":998,"value":2140},"(numbers) ",{"type":993,"tag":1021,"props":2142,"children":2143},{"style":1036},[2144],{"type":998,"value":1755},{"type":993,"tag":1021,"props":2146,"children":2147},{"style":1089},[2148],{"type":998,"value":1092},{"type":993,"tag":1021,"props":2150,"children":2151},{"style":1048},[2152],{"type":998,"value":1097},{"type":993,"tag":1021,"props":2154,"children":2155},{"class":1023,"line":136},[2156,2160,2164,2168],{"type":993,"tag":1021,"props":2157,"children":2158},{"style":1036},[2159],{"type":998,"value":1105},{"type":993,"tag":1021,"props":2161,"children":2162},{"style":1048},[2163],{"type":998,"value":2056},{"type":993,"tag":1021,"props":2165,"children":2166},{"style":1089},[2167],{"type":998,"value":1328},{"type":993,"tag":1021,"props":2169,"children":2170},{"style":1048},[2171],{"type":998,"value":2172},"]\n",{"type":993,"tag":1021,"props":2174,"children":2175},{"class":1023,"line":146},[2176],{"type":993,"tag":1021,"props":2177,"children":2178},{"style":1048},[2179],{"type":998,"value":1118},{"type":993,"tag":1021,"props":2181,"children":2182},{"class":1023,"line":155},[2183],{"type":993,"tag":1021,"props":2184,"children":2185},{"style":1027},[2186],{"type":998,"value":2187},"    # Recursive case: max of first vs max of rest\n",{"type":993,"tag":1021,"props":2189,"children":2190},{"class":1023,"line":164},[2191,2196,2201,2206,2210],{"type":993,"tag":1021,"props":2192,"children":2193},{"style":1048},[2194],{"type":998,"value":2195},"    max_of_rest ",{"type":993,"tag":1021,"props":2197,"children":2198},{"style":1036},[2199],{"type":998,"value":2200},"=",{"type":993,"tag":1021,"props":2202,"children":2203},{"style":1048},[2204],{"type":998,"value":2205}," find_maximum(numbers[",{"type":993,"tag":1021,"props":2207,"children":2208},{"style":1089},[2209],{"type":998,"value":2079},{"type":993,"tag":1021,"props":2211,"children":2212},{"style":1048},[2213],{"type":998,"value":2084},{"type":993,"tag":1021,"props":2215,"children":2216},{"class":1023,"line":173},[2217,2221,2226,2231,2235],{"type":993,"tag":1021,"props":2218,"children":2219},{"style":1036},[2220],{"type":998,"value":1134},{"type":993,"tag":1021,"props":2222,"children":2223},{"style":1089},[2224],{"type":998,"value":2225}," max",{"type":993,"tag":1021,"props":2227,"children":2228},{"style":1048},[2229],{"type":998,"value":2230},"(numbers[",{"type":993,"tag":1021,"props":2232,"children":2233},{"style":1089},[2234],{"type":998,"value":1328},{"type":993,"tag":1021,"props":2236,"children":2237},{"style":1048},[2238],{"type":998,"value":2239},"], max_of_rest)\n",{"type":993,"tag":1021,"props":2241,"children":2242},{"class":1023,"line":182},[2243],{"type":993,"tag":1021,"props":2244,"children":2245},{"emptyLinePlaceholder":13},[2246],{"type":998,"value":1170},{"type":993,"tag":1021,"props":2248,"children":2249},{"class":1023,"line":191},[2250],{"type":993,"tag":1021,"props":2251,"children":2252},{"style":1027},[2253],{"type":998,"value":2254},"# Test recursive functions\n",{"type":993,"tag":1021,"props":2256,"children":2257},{"class":1023,"line":201},[2258,2263,2267,2272,2276,2281,2286,2290,2295,2299,2304,2308,2312],{"type":993,"tag":1021,"props":2259,"children":2260},{"style":1048},[2261],{"type":998,"value":2262},"data ",{"type":993,"tag":1021,"props":2264,"children":2265},{"style":1036},[2266],{"type":998,"value":2200},{"type":993,"tag":1021,"props":2268,"children":2269},{"style":1048},[2270],{"type":998,"value":2271}," [",{"type":993,"tag":1021,"props":2273,"children":2274},{"style":1089},[2275],{"type":998,"value":1274},{"type":993,"tag":1021,"props":2277,"children":2278},{"style":1048},[2279],{"type":998,"value":2280},", ",{"type":993,"tag":1021,"props":2282,"children":2283},{"style":1089},[2284],{"type":998,"value":2285},"7",{"type":993,"tag":1021,"props":2287,"children":2288},{"style":1048},[2289],{"type":998,"value":2280},{"type":993,"tag":1021,"props":2291,"children":2292},{"style":1089},[2293],{"type":998,"value":2294},"2",{"type":993,"tag":1021,"props":2296,"children":2297},{"style":1048},[2298],{"type":998,"value":2280},{"type":993,"tag":1021,"props":2300,"children":2301},{"style":1089},[2302],{"type":998,"value":2303},"9",{"type":993,"tag":1021,"props":2305,"children":2306},{"style":1048},[2307],{"type":998,"value":2280},{"type":993,"tag":1021,"props":2309,"children":2310},{"style":1089},[2311],{"type":998,"value":2079},{"type":993,"tag":1021,"props":2313,"children":2314},{"style":1048},[2315],{"type":998,"value":2172},{"type":993,"tag":1021,"props":2317,"children":2318},{"class":1023,"line":210},[2319,2323,2327,2331,2336,2340,2345,2349,2353],{"type":993,"tag":1021,"props":2320,"children":2321},{"style":1089},[2322],{"type":998,"value":1186},{"type":993,"tag":1021,"props":2324,"children":2325},{"style":1048},[2326],{"type":998,"value":1191},{"type":993,"tag":1021,"props":2328,"children":2329},{"style":1036},[2330],{"type":998,"value":1196},{"type":993,"tag":1021,"props":2332,"children":2333},{"style":1057},[2334],{"type":998,"value":2335},"\"Sum: ",{"type":993,"tag":1021,"props":2337,"children":2338},{"style":1089},[2339],{"type":998,"value":1206},{"type":993,"tag":1021,"props":2341,"children":2342},{"style":1048},[2343],{"type":998,"value":2344},"recursive_sum(data)",{"type":993,"tag":1021,"props":2346,"children":2347},{"style":1089},[2348],{"type":998,"value":1226},{"type":993,"tag":1021,"props":2350,"children":2351},{"style":1057},[2352],{"type":998,"value":1231},{"type":993,"tag":1021,"props":2354,"children":2355},{"style":1048},[2356],{"type":998,"value":1162},{"type":993,"tag":1021,"props":2358,"children":2359},{"class":1023,"line":219},[2360,2364,2368,2372,2377,2381,2386,2390,2394],{"type":993,"tag":1021,"props":2361,"children":2362},{"style":1089},[2363],{"type":998,"value":1186},{"type":993,"tag":1021,"props":2365,"children":2366},{"style":1048},[2367],{"type":998,"value":1191},{"type":993,"tag":1021,"props":2369,"children":2370},{"style":1036},[2371],{"type":998,"value":1196},{"type":993,"tag":1021,"props":2373,"children":2374},{"style":1057},[2375],{"type":998,"value":2376},"\"Maximum: ",{"type":993,"tag":1021,"props":2378,"children":2379},{"style":1089},[2380],{"type":998,"value":1206},{"type":993,"tag":1021,"props":2382,"children":2383},{"style":1048},[2384],{"type":998,"value":2385},"find_maximum(data)",{"type":993,"tag":1021,"props":2387,"children":2388},{"style":1089},[2389],{"type":998,"value":1226},{"type":993,"tag":1021,"props":2391,"children":2392},{"style":1057},[2393],{"type":998,"value":1231},{"type":993,"tag":1021,"props":2395,"children":2396},{"style":1048},[2397],{"type":998,"value":1162},{"type":993,"tag":1351,"props":2399,"children":2401},{"id":2400},"recursion-vs-iteration",[2402],{"type":998,"value":2403},"🚀 Recursion vs Iteration",{"type":993,"tag":1001,"props":2405,"children":2406},{},[2407],{"type":998,"value":2408},"Understanding when to use recursion versus loops helps you choose the most appropriate solution for each problem type.",{"type":993,"tag":1363,"props":2410,"children":2412},{"id":2411},"recursive-approach-benefits",[2413],{"type":998,"value":2414},"Recursive Approach Benefits",{"type":993,"tag":1001,"props":2416,"children":2417},{},[2418],{"type":998,"value":2419},"Recursion provides elegant solutions for problems with naturally recursive structure, often resulting in cleaner, more intuitive code.",{"type":993,"tag":1007,"props":2421,"children":2422},{},[2423],{"type":993,"tag":1011,"props":2424,"children":2426},{"className":1013,"code":2425,"language":6,"meta":8,"style":8},"def power_recursive(base, exponent):\n    \"\"\"Calculate base^exponent recursively\"\"\"\n    # Base case\n    if exponent == 0:\n        return 1\n    \n    # Recursive case\n    return base * power_recursive(base, exponent - 1)\n\ndef power_iterative(base, exponent):\n    \"\"\"Calculate base^exponent iteratively\"\"\"\n    result = 1\n    for _ in range(exponent):\n        result *= base\n    return result\n\n# Both approaches produce same result\nbase, exp = 2, 5\nprint(f\"Recursive: {base}^{exp} = {power_recursive(base, exp)}\")\nprint(f\"Iterative: {base}^{exp} = {power_iterative(base, exp)}\")\n",[2427],{"type":993,"tag":1017,"props":2428,"children":2429},{"__ignoreMap":8},[2430,2447,2455,2463,2487,2498,2505,2513,2546,2553,2569,2577,2593,2619,2637,2649,2656,2664,2689,2766],{"type":993,"tag":1021,"props":2431,"children":2432},{"class":1023,"line":12},[2433,2437,2442],{"type":993,"tag":1021,"props":2434,"children":2435},{"style":1036},[2436],{"type":998,"value":1039},{"type":993,"tag":1021,"props":2438,"children":2439},{"style":1042},[2440],{"type":998,"value":2441}," power_recursive",{"type":993,"tag":1021,"props":2443,"children":2444},{"style":1048},[2445],{"type":998,"value":2446},"(base, exponent):\n",{"type":993,"tag":1021,"props":2448,"children":2449},{"class":1023,"line":27},[2450],{"type":993,"tag":1021,"props":2451,"children":2452},{"style":1057},[2453],{"type":998,"value":2454},"    \"\"\"Calculate base^exponent recursively\"\"\"\n",{"type":993,"tag":1021,"props":2456,"children":2457},{"class":1023,"line":36},[2458],{"type":993,"tag":1021,"props":2459,"children":2460},{"style":1027},[2461],{"type":998,"value":2462},"    # Base case\n",{"type":993,"tag":1021,"props":2464,"children":2465},{"class":1023,"line":45},[2466,2470,2475,2479,2483],{"type":993,"tag":1021,"props":2467,"children":2468},{"style":1036},[2469],{"type":998,"value":1076},{"type":993,"tag":1021,"props":2471,"children":2472},{"style":1048},[2473],{"type":998,"value":2474}," exponent ",{"type":993,"tag":1021,"props":2476,"children":2477},{"style":1036},[2478],{"type":998,"value":1755},{"type":993,"tag":1021,"props":2480,"children":2481},{"style":1089},[2482],{"type":998,"value":1435},{"type":993,"tag":1021,"props":2484,"children":2485},{"style":1048},[2486],{"type":998,"value":1097},{"type":993,"tag":1021,"props":2488,"children":2489},{"class":1023,"line":54},[2490,2494],{"type":993,"tag":1021,"props":2491,"children":2492},{"style":1036},[2493],{"type":998,"value":1105},{"type":993,"tag":1021,"props":2495,"children":2496},{"style":1089},[2497],{"type":998,"value":1110},{"type":993,"tag":1021,"props":2499,"children":2500},{"class":1023,"line":63},[2501],{"type":993,"tag":1021,"props":2502,"children":2503},{"style":1048},[2504],{"type":998,"value":1118},{"type":993,"tag":1021,"props":2506,"children":2507},{"class":1023,"line":72},[2508],{"type":993,"tag":1021,"props":2509,"children":2510},{"style":1027},[2511],{"type":998,"value":2512},"    # Recursive case\n",{"type":993,"tag":1021,"props":2514,"children":2515},{"class":1023,"line":81},[2516,2520,2525,2529,2534,2538,2542],{"type":993,"tag":1021,"props":2517,"children":2518},{"style":1036},[2519],{"type":998,"value":1134},{"type":993,"tag":1021,"props":2521,"children":2522},{"style":1048},[2523],{"type":998,"value":2524}," base ",{"type":993,"tag":1021,"props":2526,"children":2527},{"style":1036},[2528],{"type":998,"value":1143},{"type":993,"tag":1021,"props":2530,"children":2531},{"style":1048},[2532],{"type":998,"value":2533}," power_recursive(base, exponent ",{"type":993,"tag":1021,"props":2535,"children":2536},{"style":1036},[2537],{"type":998,"value":1153},{"type":993,"tag":1021,"props":2539,"children":2540},{"style":1089},[2541],{"type":998,"value":1092},{"type":993,"tag":1021,"props":2543,"children":2544},{"style":1048},[2545],{"type":998,"value":1162},{"type":993,"tag":1021,"props":2547,"children":2548},{"class":1023,"line":91},[2549],{"type":993,"tag":1021,"props":2550,"children":2551},{"emptyLinePlaceholder":13},[2552],{"type":998,"value":1170},{"type":993,"tag":1021,"props":2554,"children":2555},{"class":1023,"line":100},[2556,2560,2565],{"type":993,"tag":1021,"props":2557,"children":2558},{"style":1036},[2559],{"type":998,"value":1039},{"type":993,"tag":1021,"props":2561,"children":2562},{"style":1042},[2563],{"type":998,"value":2564}," power_iterative",{"type":993,"tag":1021,"props":2566,"children":2567},{"style":1048},[2568],{"type":998,"value":2446},{"type":993,"tag":1021,"props":2570,"children":2571},{"class":1023,"line":109},[2572],{"type":993,"tag":1021,"props":2573,"children":2574},{"style":1057},[2575],{"type":998,"value":2576},"    \"\"\"Calculate base^exponent iteratively\"\"\"\n",{"type":993,"tag":1021,"props":2578,"children":2579},{"class":1023,"line":118},[2580,2585,2589],{"type":993,"tag":1021,"props":2581,"children":2582},{"style":1048},[2583],{"type":998,"value":2584},"    result ",{"type":993,"tag":1021,"props":2586,"children":2587},{"style":1036},[2588],{"type":998,"value":2200},{"type":993,"tag":1021,"props":2590,"children":2591},{"style":1089},[2592],{"type":998,"value":1110},{"type":993,"tag":1021,"props":2594,"children":2595},{"class":1023,"line":127},[2596,2601,2606,2610,2614],{"type":993,"tag":1021,"props":2597,"children":2598},{"style":1036},[2599],{"type":998,"value":2600},"    for",{"type":993,"tag":1021,"props":2602,"children":2603},{"style":1048},[2604],{"type":998,"value":2605}," _ ",{"type":993,"tag":1021,"props":2607,"children":2608},{"style":1036},[2609],{"type":998,"value":1869},{"type":993,"tag":1021,"props":2611,"children":2612},{"style":1089},[2613],{"type":998,"value":1874},{"type":993,"tag":1021,"props":2615,"children":2616},{"style":1048},[2617],{"type":998,"value":2618},"(exponent):\n",{"type":993,"tag":1021,"props":2620,"children":2621},{"class":1023,"line":136},[2622,2627,2632],{"type":993,"tag":1021,"props":2623,"children":2624},{"style":1048},[2625],{"type":998,"value":2626},"        result ",{"type":993,"tag":1021,"props":2628,"children":2629},{"style":1036},[2630],{"type":998,"value":2631},"*=",{"type":993,"tag":1021,"props":2633,"children":2634},{"style":1048},[2635],{"type":998,"value":2636}," base\n",{"type":993,"tag":1021,"props":2638,"children":2639},{"class":1023,"line":146},[2640,2644],{"type":993,"tag":1021,"props":2641,"children":2642},{"style":1036},[2643],{"type":998,"value":1134},{"type":993,"tag":1021,"props":2645,"children":2646},{"style":1048},[2647],{"type":998,"value":2648}," result\n",{"type":993,"tag":1021,"props":2650,"children":2651},{"class":1023,"line":155},[2652],{"type":993,"tag":1021,"props":2653,"children":2654},{"emptyLinePlaceholder":13},[2655],{"type":998,"value":1170},{"type":993,"tag":1021,"props":2657,"children":2658},{"class":1023,"line":164},[2659],{"type":993,"tag":1021,"props":2660,"children":2661},{"style":1027},[2662],{"type":998,"value":2663},"# Both approaches produce same result\n",{"type":993,"tag":1021,"props":2665,"children":2666},{"class":1023,"line":173},[2667,2672,2676,2680,2684],{"type":993,"tag":1021,"props":2668,"children":2669},{"style":1048},[2670],{"type":998,"value":2671},"base, exp ",{"type":993,"tag":1021,"props":2673,"children":2674},{"style":1036},[2675],{"type":998,"value":2200},{"type":993,"tag":1021,"props":2677,"children":2678},{"style":1089},[2679],{"type":998,"value":1832},{"type":993,"tag":1021,"props":2681,"children":2682},{"style":1048},[2683],{"type":998,"value":2280},{"type":993,"tag":1021,"props":2685,"children":2686},{"style":1089},[2687],{"type":998,"value":2688},"5\n",{"type":993,"tag":1021,"props":2690,"children":2691},{"class":1023,"line":182},[2692,2696,2700,2704,2709,2713,2718,2722,2727,2731,2736,2740,2745,2749,2754,2758,2762],{"type":993,"tag":1021,"props":2693,"children":2694},{"style":1089},[2695],{"type":998,"value":1186},{"type":993,"tag":1021,"props":2697,"children":2698},{"style":1048},[2699],{"type":998,"value":1191},{"type":993,"tag":1021,"props":2701,"children":2702},{"style":1036},[2703],{"type":998,"value":1196},{"type":993,"tag":1021,"props":2705,"children":2706},{"style":1057},[2707],{"type":998,"value":2708},"\"Recursive: ",{"type":993,"tag":1021,"props":2710,"children":2711},{"style":1089},[2712],{"type":998,"value":1206},{"type":993,"tag":1021,"props":2714,"children":2715},{"style":1048},[2716],{"type":998,"value":2717},"base",{"type":993,"tag":1021,"props":2719,"children":2720},{"style":1089},[2721],{"type":998,"value":1226},{"type":993,"tag":1021,"props":2723,"children":2724},{"style":1057},[2725],{"type":998,"value":2726},"^",{"type":993,"tag":1021,"props":2728,"children":2729},{"style":1089},[2730],{"type":998,"value":1206},{"type":993,"tag":1021,"props":2732,"children":2733},{"style":1048},[2734],{"type":998,"value":2735},"exp",{"type":993,"tag":1021,"props":2737,"children":2738},{"style":1089},[2739],{"type":998,"value":1226},{"type":993,"tag":1021,"props":2741,"children":2742},{"style":1057},[2743],{"type":998,"value":2744}," = ",{"type":993,"tag":1021,"props":2746,"children":2747},{"style":1089},[2748],{"type":998,"value":1206},{"type":993,"tag":1021,"props":2750,"children":2751},{"style":1048},[2752],{"type":998,"value":2753},"power_recursive(base, exp)",{"type":993,"tag":1021,"props":2755,"children":2756},{"style":1089},[2757],{"type":998,"value":1226},{"type":993,"tag":1021,"props":2759,"children":2760},{"style":1057},[2761],{"type":998,"value":1231},{"type":993,"tag":1021,"props":2763,"children":2764},{"style":1048},[2765],{"type":998,"value":1162},{"type":993,"tag":1021,"props":2767,"children":2768},{"class":1023,"line":191},[2769,2773,2777,2781,2786,2790,2794,2798,2802,2806,2810,2814,2818,2822,2827,2831,2835],{"type":993,"tag":1021,"props":2770,"children":2771},{"style":1089},[2772],{"type":998,"value":1186},{"type":993,"tag":1021,"props":2774,"children":2775},{"style":1048},[2776],{"type":998,"value":1191},{"type":993,"tag":1021,"props":2778,"children":2779},{"style":1036},[2780],{"type":998,"value":1196},{"type":993,"tag":1021,"props":2782,"children":2783},{"style":1057},[2784],{"type":998,"value":2785},"\"Iterative: ",{"type":993,"tag":1021,"props":2787,"children":2788},{"style":1089},[2789],{"type":998,"value":1206},{"type":993,"tag":1021,"props":2791,"children":2792},{"style":1048},[2793],{"type":998,"value":2717},{"type":993,"tag":1021,"props":2795,"children":2796},{"style":1089},[2797],{"type":998,"value":1226},{"type":993,"tag":1021,"props":2799,"children":2800},{"style":1057},[2801],{"type":998,"value":2726},{"type":993,"tag":1021,"props":2803,"children":2804},{"style":1089},[2805],{"type":998,"value":1206},{"type":993,"tag":1021,"props":2807,"children":2808},{"style":1048},[2809],{"type":998,"value":2735},{"type":993,"tag":1021,"props":2811,"children":2812},{"style":1089},[2813],{"type":998,"value":1226},{"type":993,"tag":1021,"props":2815,"children":2816},{"style":1057},[2817],{"type":998,"value":2744},{"type":993,"tag":1021,"props":2819,"children":2820},{"style":1089},[2821],{"type":998,"value":1206},{"type":993,"tag":1021,"props":2823,"children":2824},{"style":1048},[2825],{"type":998,"value":2826},"power_iterative(base, exp)",{"type":993,"tag":1021,"props":2828,"children":2829},{"style":1089},[2830],{"type":998,"value":1226},{"type":993,"tag":1021,"props":2832,"children":2833},{"style":1057},[2834],{"type":998,"value":1231},{"type":993,"tag":1021,"props":2836,"children":2837},{"style":1048},[2838],{"type":998,"value":1162},{"type":993,"tag":1363,"props":2840,"children":2842},{"id":2841},"performance-considerations",[2843],{"type":998,"value":2844},"Performance Considerations",{"type":993,"tag":1001,"props":2846,"children":2847},{},[2848],{"type":998,"value":2849},"Recursive solutions can be less efficient due to function call overhead and potential repeated calculations, but offer code clarity for appropriate problems.",{"type":993,"tag":1351,"props":2851,"children":2853},{"id":2852},"tree-and-nested-structure-processing",[2854],{"type":998,"value":2855},"🌟 Tree and Nested Structure Processing",{"type":993,"tag":1001,"props":2857,"children":2858},{},[2859],{"type":998,"value":2860},"Recursion excels at processing hierarchical data structures like trees, nested lists, or directory structures where the data has self-similar structure.",{"type":993,"tag":1363,"props":2862,"children":2864},{"id":2863},"processing-nested-lists",[2865],{"type":998,"value":2866},"Processing Nested Lists",{"type":993,"tag":1001,"props":2868,"children":2869},{},[2870],{"type":998,"value":2871},"Recursive functions naturally handle nested data structures by processing each level and recursing on nested elements.",{"type":993,"tag":1007,"props":2873,"children":2874},{},[2875],{"type":993,"tag":1011,"props":2876,"children":2878},{"className":1013,"code":2877,"language":6,"meta":8,"style":8},"def flatten_list(nested_list):\n    \"\"\"Flatten nested list structure recursively\"\"\"\n    result = []\n    \n    for item in nested_list:\n        if isinstance(item, list):\n            # Recursive case: item is a list\n            result.extend(flatten_list(item))\n        else:\n            # Base case: item is not a list\n            result.append(item)\n    \n    return result\n\ndef count_elements(nested_list):\n    \"\"\"Count total elements in nested list\"\"\"\n    count = 0\n    \n    for item in nested_list:\n        if isinstance(item, list):\n            count += count_elements(item)  # Recurse on sublists\n        else:\n            count += 1  # Count individual elements\n    \n    return count\n\n# Test with nested data\nnested_data = [1, [2, 3], [4, [5, 6]], 7]\nprint(f\"Original: {nested_data}\")\nprint(f\"Flattened: {flatten_list(nested_data)}\")\nprint(f\"Total elements: {count_elements(nested_data)}\")\n",[2879],{"type":993,"tag":1017,"props":2880,"children":2881},{"__ignoreMap":8},[2882,2899,2907,2923,2930,2951,2978,2986,2994,3006,3014,3022,3029,3040,3047,3063,3071,3087,3094,3113,3136,3159,3170,3190,3197,3209,3216,3224,3301,3342,3383],{"type":993,"tag":1021,"props":2883,"children":2884},{"class":1023,"line":12},[2885,2889,2894],{"type":993,"tag":1021,"props":2886,"children":2887},{"style":1036},[2888],{"type":998,"value":1039},{"type":993,"tag":1021,"props":2890,"children":2891},{"style":1042},[2892],{"type":998,"value":2893}," flatten_list",{"type":993,"tag":1021,"props":2895,"children":2896},{"style":1048},[2897],{"type":998,"value":2898},"(nested_list):\n",{"type":993,"tag":1021,"props":2900,"children":2901},{"class":1023,"line":27},[2902],{"type":993,"tag":1021,"props":2903,"children":2904},{"style":1057},[2905],{"type":998,"value":2906},"    \"\"\"Flatten nested list structure recursively\"\"\"\n",{"type":993,"tag":1021,"props":2908,"children":2909},{"class":1023,"line":36},[2910,2914,2918],{"type":993,"tag":1021,"props":2911,"children":2912},{"style":1048},[2913],{"type":998,"value":2584},{"type":993,"tag":1021,"props":2915,"children":2916},{"style":1036},[2917],{"type":998,"value":2200},{"type":993,"tag":1021,"props":2919,"children":2920},{"style":1048},[2921],{"type":998,"value":2922}," []\n",{"type":993,"tag":1021,"props":2924,"children":2925},{"class":1023,"line":45},[2926],{"type":993,"tag":1021,"props":2927,"children":2928},{"style":1048},[2929],{"type":998,"value":1118},{"type":993,"tag":1021,"props":2931,"children":2932},{"class":1023,"line":54},[2933,2937,2942,2946],{"type":993,"tag":1021,"props":2934,"children":2935},{"style":1036},[2936],{"type":998,"value":2600},{"type":993,"tag":1021,"props":2938,"children":2939},{"style":1048},[2940],{"type":998,"value":2941}," item ",{"type":993,"tag":1021,"props":2943,"children":2944},{"style":1036},[2945],{"type":998,"value":1869},{"type":993,"tag":1021,"props":2947,"children":2948},{"style":1048},[2949],{"type":998,"value":2950}," nested_list:\n",{"type":993,"tag":1021,"props":2952,"children":2953},{"class":1023,"line":63},[2954,2959,2964,2969,2974],{"type":993,"tag":1021,"props":2955,"children":2956},{"style":1036},[2957],{"type":998,"value":2958},"        if",{"type":993,"tag":1021,"props":2960,"children":2961},{"style":1089},[2962],{"type":998,"value":2963}," isinstance",{"type":993,"tag":1021,"props":2965,"children":2966},{"style":1048},[2967],{"type":998,"value":2968},"(item, ",{"type":993,"tag":1021,"props":2970,"children":2971},{"style":1089},[2972],{"type":998,"value":2973},"list",{"type":993,"tag":1021,"props":2975,"children":2976},{"style":1048},[2977],{"type":998,"value":1888},{"type":993,"tag":1021,"props":2979,"children":2980},{"class":1023,"line":72},[2981],{"type":993,"tag":1021,"props":2982,"children":2983},{"style":1027},[2984],{"type":998,"value":2985},"            # Recursive case: item is a list\n",{"type":993,"tag":1021,"props":2987,"children":2988},{"class":1023,"line":81},[2989],{"type":993,"tag":1021,"props":2990,"children":2991},{"style":1048},[2992],{"type":998,"value":2993},"            result.extend(flatten_list(item))\n",{"type":993,"tag":1021,"props":2995,"children":2996},{"class":1023,"line":91},[2997,3002],{"type":993,"tag":1021,"props":2998,"children":2999},{"style":1036},[3000],{"type":998,"value":3001},"        else",{"type":993,"tag":1021,"props":3003,"children":3004},{"style":1048},[3005],{"type":998,"value":1097},{"type":993,"tag":1021,"props":3007,"children":3008},{"class":1023,"line":100},[3009],{"type":993,"tag":1021,"props":3010,"children":3011},{"style":1027},[3012],{"type":998,"value":3013},"            # Base case: item is not a list\n",{"type":993,"tag":1021,"props":3015,"children":3016},{"class":1023,"line":109},[3017],{"type":993,"tag":1021,"props":3018,"children":3019},{"style":1048},[3020],{"type":998,"value":3021},"            result.append(item)\n",{"type":993,"tag":1021,"props":3023,"children":3024},{"class":1023,"line":118},[3025],{"type":993,"tag":1021,"props":3026,"children":3027},{"style":1048},[3028],{"type":998,"value":1118},{"type":993,"tag":1021,"props":3030,"children":3031},{"class":1023,"line":127},[3032,3036],{"type":993,"tag":1021,"props":3033,"children":3034},{"style":1036},[3035],{"type":998,"value":1134},{"type":993,"tag":1021,"props":3037,"children":3038},{"style":1048},[3039],{"type":998,"value":2648},{"type":993,"tag":1021,"props":3041,"children":3042},{"class":1023,"line":136},[3043],{"type":993,"tag":1021,"props":3044,"children":3045},{"emptyLinePlaceholder":13},[3046],{"type":998,"value":1170},{"type":993,"tag":1021,"props":3048,"children":3049},{"class":1023,"line":146},[3050,3054,3059],{"type":993,"tag":1021,"props":3051,"children":3052},{"style":1036},[3053],{"type":998,"value":1039},{"type":993,"tag":1021,"props":3055,"children":3056},{"style":1042},[3057],{"type":998,"value":3058}," count_elements",{"type":993,"tag":1021,"props":3060,"children":3061},{"style":1048},[3062],{"type":998,"value":2898},{"type":993,"tag":1021,"props":3064,"children":3065},{"class":1023,"line":155},[3066],{"type":993,"tag":1021,"props":3067,"children":3068},{"style":1057},[3069],{"type":998,"value":3070},"    \"\"\"Count total elements in nested list\"\"\"\n",{"type":993,"tag":1021,"props":3072,"children":3073},{"class":1023,"line":164},[3074,3079,3083],{"type":993,"tag":1021,"props":3075,"children":3076},{"style":1048},[3077],{"type":998,"value":3078},"    count ",{"type":993,"tag":1021,"props":3080,"children":3081},{"style":1036},[3082],{"type":998,"value":2200},{"type":993,"tag":1021,"props":3084,"children":3085},{"style":1089},[3086],{"type":998,"value":1738},{"type":993,"tag":1021,"props":3088,"children":3089},{"class":1023,"line":173},[3090],{"type":993,"tag":1021,"props":3091,"children":3092},{"style":1048},[3093],{"type":998,"value":1118},{"type":993,"tag":1021,"props":3095,"children":3096},{"class":1023,"line":182},[3097,3101,3105,3109],{"type":993,"tag":1021,"props":3098,"children":3099},{"style":1036},[3100],{"type":998,"value":2600},{"type":993,"tag":1021,"props":3102,"children":3103},{"style":1048},[3104],{"type":998,"value":2941},{"type":993,"tag":1021,"props":3106,"children":3107},{"style":1036},[3108],{"type":998,"value":1869},{"type":993,"tag":1021,"props":3110,"children":3111},{"style":1048},[3112],{"type":998,"value":2950},{"type":993,"tag":1021,"props":3114,"children":3115},{"class":1023,"line":191},[3116,3120,3124,3128,3132],{"type":993,"tag":1021,"props":3117,"children":3118},{"style":1036},[3119],{"type":998,"value":2958},{"type":993,"tag":1021,"props":3121,"children":3122},{"style":1089},[3123],{"type":998,"value":2963},{"type":993,"tag":1021,"props":3125,"children":3126},{"style":1048},[3127],{"type":998,"value":2968},{"type":993,"tag":1021,"props":3129,"children":3130},{"style":1089},[3131],{"type":998,"value":2973},{"type":993,"tag":1021,"props":3133,"children":3134},{"style":1048},[3135],{"type":998,"value":1888},{"type":993,"tag":1021,"props":3137,"children":3138},{"class":1023,"line":201},[3139,3144,3149,3154],{"type":993,"tag":1021,"props":3140,"children":3141},{"style":1048},[3142],{"type":998,"value":3143},"            count ",{"type":993,"tag":1021,"props":3145,"children":3146},{"style":1036},[3147],{"type":998,"value":3148},"+=",{"type":993,"tag":1021,"props":3150,"children":3151},{"style":1048},[3152],{"type":998,"value":3153}," count_elements(item)  ",{"type":993,"tag":1021,"props":3155,"children":3156},{"style":1027},[3157],{"type":998,"value":3158},"# Recurse on sublists\n",{"type":993,"tag":1021,"props":3160,"children":3161},{"class":1023,"line":210},[3162,3166],{"type":993,"tag":1021,"props":3163,"children":3164},{"style":1036},[3165],{"type":998,"value":3001},{"type":993,"tag":1021,"props":3167,"children":3168},{"style":1048},[3169],{"type":998,"value":1097},{"type":993,"tag":1021,"props":3171,"children":3172},{"class":1023,"line":219},[3173,3177,3181,3185],{"type":993,"tag":1021,"props":3174,"children":3175},{"style":1048},[3176],{"type":998,"value":3143},{"type":993,"tag":1021,"props":3178,"children":3179},{"style":1036},[3180],{"type":998,"value":3148},{"type":993,"tag":1021,"props":3182,"children":3183},{"style":1089},[3184],{"type":998,"value":1092},{"type":993,"tag":1021,"props":3186,"children":3187},{"style":1027},[3188],{"type":998,"value":3189},"  # Count individual elements\n",{"type":993,"tag":1021,"props":3191,"children":3192},{"class":1023,"line":228},[3193],{"type":993,"tag":1021,"props":3194,"children":3195},{"style":1048},[3196],{"type":998,"value":1118},{"type":993,"tag":1021,"props":3198,"children":3199},{"class":1023,"line":238},[3200,3204],{"type":993,"tag":1021,"props":3201,"children":3202},{"style":1036},[3203],{"type":998,"value":1134},{"type":993,"tag":1021,"props":3205,"children":3206},{"style":1048},[3207],{"type":998,"value":3208}," count\n",{"type":993,"tag":1021,"props":3210,"children":3211},{"class":1023,"line":247},[3212],{"type":993,"tag":1021,"props":3213,"children":3214},{"emptyLinePlaceholder":13},[3215],{"type":998,"value":1170},{"type":993,"tag":1021,"props":3217,"children":3218},{"class":1023,"line":256},[3219],{"type":993,"tag":1021,"props":3220,"children":3221},{"style":1027},[3222],{"type":998,"value":3223},"# Test with nested data\n",{"type":993,"tag":1021,"props":3225,"children":3226},{"class":1023,"line":265},[3227,3232,3236,3240,3244,3249,3253,3257,3261,3266,3271,3275,3279,3283,3288,3293,3297],{"type":993,"tag":1021,"props":3228,"children":3229},{"style":1048},[3230],{"type":998,"value":3231},"nested_data ",{"type":993,"tag":1021,"props":3233,"children":3234},{"style":1036},[3235],{"type":998,"value":2200},{"type":993,"tag":1021,"props":3237,"children":3238},{"style":1048},[3239],{"type":998,"value":2271},{"type":993,"tag":1021,"props":3241,"children":3242},{"style":1089},[3243],{"type":998,"value":2079},{"type":993,"tag":1021,"props":3245,"children":3246},{"style":1048},[3247],{"type":998,"value":3248},", [",{"type":993,"tag":1021,"props":3250,"children":3251},{"style":1089},[3252],{"type":998,"value":2294},{"type":993,"tag":1021,"props":3254,"children":3255},{"style":1048},[3256],{"type":998,"value":2280},{"type":993,"tag":1021,"props":3258,"children":3259},{"style":1089},[3260],{"type":998,"value":1274},{"type":993,"tag":1021,"props":3262,"children":3263},{"style":1048},[3264],{"type":998,"value":3265},"], [",{"type":993,"tag":1021,"props":3267,"children":3268},{"style":1089},[3269],{"type":998,"value":3270},"4",{"type":993,"tag":1021,"props":3272,"children":3273},{"style":1048},[3274],{"type":998,"value":3248},{"type":993,"tag":1021,"props":3276,"children":3277},{"style":1089},[3278],{"type":998,"value":1216},{"type":993,"tag":1021,"props":3280,"children":3281},{"style":1048},[3282],{"type":998,"value":2280},{"type":993,"tag":1021,"props":3284,"children":3285},{"style":1089},[3286],{"type":998,"value":3287},"6",{"type":993,"tag":1021,"props":3289,"children":3290},{"style":1048},[3291],{"type":998,"value":3292},"]], ",{"type":993,"tag":1021,"props":3294,"children":3295},{"style":1089},[3296],{"type":998,"value":2285},{"type":993,"tag":1021,"props":3298,"children":3299},{"style":1048},[3300],{"type":998,"value":2172},{"type":993,"tag":1021,"props":3302,"children":3303},{"class":1023,"line":274},[3304,3308,3312,3316,3321,3325,3330,3334,3338],{"type":993,"tag":1021,"props":3305,"children":3306},{"style":1089},[3307],{"type":998,"value":1186},{"type":993,"tag":1021,"props":3309,"children":3310},{"style":1048},[3311],{"type":998,"value":1191},{"type":993,"tag":1021,"props":3313,"children":3314},{"style":1036},[3315],{"type":998,"value":1196},{"type":993,"tag":1021,"props":3317,"children":3318},{"style":1057},[3319],{"type":998,"value":3320},"\"Original: ",{"type":993,"tag":1021,"props":3322,"children":3323},{"style":1089},[3324],{"type":998,"value":1206},{"type":993,"tag":1021,"props":3326,"children":3327},{"style":1048},[3328],{"type":998,"value":3329},"nested_data",{"type":993,"tag":1021,"props":3331,"children":3332},{"style":1089},[3333],{"type":998,"value":1226},{"type":993,"tag":1021,"props":3335,"children":3336},{"style":1057},[3337],{"type":998,"value":1231},{"type":993,"tag":1021,"props":3339,"children":3340},{"style":1048},[3341],{"type":998,"value":1162},{"type":993,"tag":1021,"props":3343,"children":3344},{"class":1023,"line":284},[3345,3349,3353,3357,3362,3366,3371,3375,3379],{"type":993,"tag":1021,"props":3346,"children":3347},{"style":1089},[3348],{"type":998,"value":1186},{"type":993,"tag":1021,"props":3350,"children":3351},{"style":1048},[3352],{"type":998,"value":1191},{"type":993,"tag":1021,"props":3354,"children":3355},{"style":1036},[3356],{"type":998,"value":1196},{"type":993,"tag":1021,"props":3358,"children":3359},{"style":1057},[3360],{"type":998,"value":3361},"\"Flattened: ",{"type":993,"tag":1021,"props":3363,"children":3364},{"style":1089},[3365],{"type":998,"value":1206},{"type":993,"tag":1021,"props":3367,"children":3368},{"style":1048},[3369],{"type":998,"value":3370},"flatten_list(nested_data)",{"type":993,"tag":1021,"props":3372,"children":3373},{"style":1089},[3374],{"type":998,"value":1226},{"type":993,"tag":1021,"props":3376,"children":3377},{"style":1057},[3378],{"type":998,"value":1231},{"type":993,"tag":1021,"props":3380,"children":3381},{"style":1048},[3382],{"type":998,"value":1162},{"type":993,"tag":1021,"props":3384,"children":3385},{"class":1023,"line":293},[3386,3390,3394,3398,3403,3407,3412,3416,3420],{"type":993,"tag":1021,"props":3387,"children":3388},{"style":1089},[3389],{"type":998,"value":1186},{"type":993,"tag":1021,"props":3391,"children":3392},{"style":1048},[3393],{"type":998,"value":1191},{"type":993,"tag":1021,"props":3395,"children":3396},{"style":1036},[3397],{"type":998,"value":1196},{"type":993,"tag":1021,"props":3399,"children":3400},{"style":1057},[3401],{"type":998,"value":3402},"\"Total elements: ",{"type":993,"tag":1021,"props":3404,"children":3405},{"style":1089},[3406],{"type":998,"value":1206},{"type":993,"tag":1021,"props":3408,"children":3409},{"style":1048},[3410],{"type":998,"value":3411},"count_elements(nested_data)",{"type":993,"tag":1021,"props":3413,"children":3414},{"style":1089},[3415],{"type":998,"value":1226},{"type":993,"tag":1021,"props":3417,"children":3418},{"style":1057},[3419],{"type":998,"value":1231},{"type":993,"tag":1021,"props":3421,"children":3422},{"style":1048},[3423],{"type":998,"value":1162},{"type":993,"tag":1351,"props":3425,"children":3427},{"id":3426},"practical-applications",[3428],{"type":998,"value":3429},"💡 Practical Applications",{"type":993,"tag":1001,"props":3431,"children":3432},{},[3433],{"type":998,"value":3434},"Recursion provides elegant solutions for real-world problems involving hierarchical structures, mathematical calculations, and data processing.",{"type":993,"tag":1363,"props":3436,"children":3438},{"id":3437},"file-system-navigation",[3439],{"type":998,"value":3440},"File System Navigation",{"type":993,"tag":1001,"props":3442,"children":3443},{},[3444],{"type":998,"value":3445},"Recursive functions naturally traverse directory structures, processing files and subdirectories systematically.",{"type":993,"tag":1007,"props":3447,"children":3448},{},[3449],{"type":993,"tag":1011,"props":3450,"children":3452},{"className":1013,"code":3451,"language":6,"meta":8,"style":8},"def calculate_directory_size(file_list):\n    \"\"\"Simulate calculating directory size recursively\"\"\"\n    total_size = 0\n    \n    for item in file_list:\n        if item['type'] == 'file':\n            total_size += item['size']\n        elif item['type'] == 'directory':\n            # Recursive case: process subdirectory\n            total_size += calculate_directory_size(item['contents'])\n    \n    return total_size\n\n# Simulate file system structure\nfile_system = [\n    {'type': 'file', 'name': 'document.txt', 'size': 1024},\n    {'type': 'directory', 'name': 'images', 'contents': [\n        {'type': 'file', 'name': 'photo1.jpg', 'size': 2048},\n        {'type': 'file', 'name': 'photo2.jpg', 'size': 1536}\n    ]},\n    {'type': 'file', 'name': 'data.csv', 'size': 512}\n]\n\ntotal = calculate_directory_size(file_system)\nprint(f\"Total directory size: {total} bytes\")\n",[3453],{"type":993,"tag":1017,"props":3454,"children":3455},{"__ignoreMap":8},[3456,3473,3481,3497,3504,3524,3558,3583,3616,3624,3650,3657,3669,3676,3684,3701,3763,3813,3871,3929,3937,3994,4001,4008,4025],{"type":993,"tag":1021,"props":3457,"children":3458},{"class":1023,"line":12},[3459,3463,3468],{"type":993,"tag":1021,"props":3460,"children":3461},{"style":1036},[3462],{"type":998,"value":1039},{"type":993,"tag":1021,"props":3464,"children":3465},{"style":1042},[3466],{"type":998,"value":3467}," calculate_directory_size",{"type":993,"tag":1021,"props":3469,"children":3470},{"style":1048},[3471],{"type":998,"value":3472},"(file_list):\n",{"type":993,"tag":1021,"props":3474,"children":3475},{"class":1023,"line":27},[3476],{"type":993,"tag":1021,"props":3477,"children":3478},{"style":1057},[3479],{"type":998,"value":3480},"    \"\"\"Simulate calculating directory size recursively\"\"\"\n",{"type":993,"tag":1021,"props":3482,"children":3483},{"class":1023,"line":36},[3484,3489,3493],{"type":993,"tag":1021,"props":3485,"children":3486},{"style":1048},[3487],{"type":998,"value":3488},"    total_size ",{"type":993,"tag":1021,"props":3490,"children":3491},{"style":1036},[3492],{"type":998,"value":2200},{"type":993,"tag":1021,"props":3494,"children":3495},{"style":1089},[3496],{"type":998,"value":1738},{"type":993,"tag":1021,"props":3498,"children":3499},{"class":1023,"line":45},[3500],{"type":993,"tag":1021,"props":3501,"children":3502},{"style":1048},[3503],{"type":998,"value":1118},{"type":993,"tag":1021,"props":3505,"children":3506},{"class":1023,"line":54},[3507,3511,3515,3519],{"type":993,"tag":1021,"props":3508,"children":3509},{"style":1036},[3510],{"type":998,"value":2600},{"type":993,"tag":1021,"props":3512,"children":3513},{"style":1048},[3514],{"type":998,"value":2941},{"type":993,"tag":1021,"props":3516,"children":3517},{"style":1036},[3518],{"type":998,"value":1869},{"type":993,"tag":1021,"props":3520,"children":3521},{"style":1048},[3522],{"type":998,"value":3523}," file_list:\n",{"type":993,"tag":1021,"props":3525,"children":3526},{"class":1023,"line":63},[3527,3531,3536,3541,3545,3549,3554],{"type":993,"tag":1021,"props":3528,"children":3529},{"style":1036},[3530],{"type":998,"value":2958},{"type":993,"tag":1021,"props":3532,"children":3533},{"style":1048},[3534],{"type":998,"value":3535}," item[",{"type":993,"tag":1021,"props":3537,"children":3538},{"style":1057},[3539],{"type":998,"value":3540},"'type'",{"type":993,"tag":1021,"props":3542,"children":3543},{"style":1048},[3544],{"type":998,"value":2065},{"type":993,"tag":1021,"props":3546,"children":3547},{"style":1036},[3548],{"type":998,"value":1755},{"type":993,"tag":1021,"props":3550,"children":3551},{"style":1057},[3552],{"type":998,"value":3553}," 'file'",{"type":993,"tag":1021,"props":3555,"children":3556},{"style":1048},[3557],{"type":998,"value":1097},{"type":993,"tag":1021,"props":3559,"children":3560},{"class":1023,"line":72},[3561,3566,3570,3574,3579],{"type":993,"tag":1021,"props":3562,"children":3563},{"style":1048},[3564],{"type":998,"value":3565},"            total_size ",{"type":993,"tag":1021,"props":3567,"children":3568},{"style":1036},[3569],{"type":998,"value":3148},{"type":993,"tag":1021,"props":3571,"children":3572},{"style":1048},[3573],{"type":998,"value":3535},{"type":993,"tag":1021,"props":3575,"children":3576},{"style":1057},[3577],{"type":998,"value":3578},"'size'",{"type":993,"tag":1021,"props":3580,"children":3581},{"style":1048},[3582],{"type":998,"value":2172},{"type":993,"tag":1021,"props":3584,"children":3585},{"class":1023,"line":81},[3586,3591,3595,3599,3603,3607,3612],{"type":993,"tag":1021,"props":3587,"children":3588},{"style":1036},[3589],{"type":998,"value":3590},"        elif",{"type":993,"tag":1021,"props":3592,"children":3593},{"style":1048},[3594],{"type":998,"value":3535},{"type":993,"tag":1021,"props":3596,"children":3597},{"style":1057},[3598],{"type":998,"value":3540},{"type":993,"tag":1021,"props":3600,"children":3601},{"style":1048},[3602],{"type":998,"value":2065},{"type":993,"tag":1021,"props":3604,"children":3605},{"style":1036},[3606],{"type":998,"value":1755},{"type":993,"tag":1021,"props":3608,"children":3609},{"style":1057},[3610],{"type":998,"value":3611}," 'directory'",{"type":993,"tag":1021,"props":3613,"children":3614},{"style":1048},[3615],{"type":998,"value":1097},{"type":993,"tag":1021,"props":3617,"children":3618},{"class":1023,"line":91},[3619],{"type":993,"tag":1021,"props":3620,"children":3621},{"style":1027},[3622],{"type":998,"value":3623},"            # Recursive case: process subdirectory\n",{"type":993,"tag":1021,"props":3625,"children":3626},{"class":1023,"line":100},[3627,3631,3635,3640,3645],{"type":993,"tag":1021,"props":3628,"children":3629},{"style":1048},[3630],{"type":998,"value":3565},{"type":993,"tag":1021,"props":3632,"children":3633},{"style":1036},[3634],{"type":998,"value":3148},{"type":993,"tag":1021,"props":3636,"children":3637},{"style":1048},[3638],{"type":998,"value":3639}," calculate_directory_size(item[",{"type":993,"tag":1021,"props":3641,"children":3642},{"style":1057},[3643],{"type":998,"value":3644},"'contents'",{"type":993,"tag":1021,"props":3646,"children":3647},{"style":1048},[3648],{"type":998,"value":3649},"])\n",{"type":993,"tag":1021,"props":3651,"children":3652},{"class":1023,"line":109},[3653],{"type":993,"tag":1021,"props":3654,"children":3655},{"style":1048},[3656],{"type":998,"value":1118},{"type":993,"tag":1021,"props":3658,"children":3659},{"class":1023,"line":118},[3660,3664],{"type":993,"tag":1021,"props":3661,"children":3662},{"style":1036},[3663],{"type":998,"value":1134},{"type":993,"tag":1021,"props":3665,"children":3666},{"style":1048},[3667],{"type":998,"value":3668}," total_size\n",{"type":993,"tag":1021,"props":3670,"children":3671},{"class":1023,"line":127},[3672],{"type":993,"tag":1021,"props":3673,"children":3674},{"emptyLinePlaceholder":13},[3675],{"type":998,"value":1170},{"type":993,"tag":1021,"props":3677,"children":3678},{"class":1023,"line":136},[3679],{"type":993,"tag":1021,"props":3680,"children":3681},{"style":1027},[3682],{"type":998,"value":3683},"# Simulate file system structure\n",{"type":993,"tag":1021,"props":3685,"children":3686},{"class":1023,"line":146},[3687,3692,3696],{"type":993,"tag":1021,"props":3688,"children":3689},{"style":1048},[3690],{"type":998,"value":3691},"file_system ",{"type":993,"tag":1021,"props":3693,"children":3694},{"style":1036},[3695],{"type":998,"value":2200},{"type":993,"tag":1021,"props":3697,"children":3698},{"style":1048},[3699],{"type":998,"value":3700}," [\n",{"type":993,"tag":1021,"props":3702,"children":3703},{"class":1023,"line":155},[3704,3709,3713,3718,3723,3727,3732,3736,3741,3745,3749,3753,3758],{"type":993,"tag":1021,"props":3705,"children":3706},{"style":1048},[3707],{"type":998,"value":3708},"    {",{"type":993,"tag":1021,"props":3710,"children":3711},{"style":1057},[3712],{"type":998,"value":3540},{"type":993,"tag":1021,"props":3714,"children":3715},{"style":1048},[3716],{"type":998,"value":3717},": ",{"type":993,"tag":1021,"props":3719,"children":3720},{"style":1057},[3721],{"type":998,"value":3722},"'file'",{"type":993,"tag":1021,"props":3724,"children":3725},{"style":1048},[3726],{"type":998,"value":2280},{"type":993,"tag":1021,"props":3728,"children":3729},{"style":1057},[3730],{"type":998,"value":3731},"'name'",{"type":993,"tag":1021,"props":3733,"children":3734},{"style":1048},[3735],{"type":998,"value":3717},{"type":993,"tag":1021,"props":3737,"children":3738},{"style":1057},[3739],{"type":998,"value":3740},"'document.txt'",{"type":993,"tag":1021,"props":3742,"children":3743},{"style":1048},[3744],{"type":998,"value":2280},{"type":993,"tag":1021,"props":3746,"children":3747},{"style":1057},[3748],{"type":998,"value":3578},{"type":993,"tag":1021,"props":3750,"children":3751},{"style":1048},[3752],{"type":998,"value":3717},{"type":993,"tag":1021,"props":3754,"children":3755},{"style":1089},[3756],{"type":998,"value":3757},"1024",{"type":993,"tag":1021,"props":3759,"children":3760},{"style":1048},[3761],{"type":998,"value":3762},"},\n",{"type":993,"tag":1021,"props":3764,"children":3765},{"class":1023,"line":164},[3766,3770,3774,3778,3783,3787,3791,3795,3800,3804,3808],{"type":993,"tag":1021,"props":3767,"children":3768},{"style":1048},[3769],{"type":998,"value":3708},{"type":993,"tag":1021,"props":3771,"children":3772},{"style":1057},[3773],{"type":998,"value":3540},{"type":993,"tag":1021,"props":3775,"children":3776},{"style":1048},[3777],{"type":998,"value":3717},{"type":993,"tag":1021,"props":3779,"children":3780},{"style":1057},[3781],{"type":998,"value":3782},"'directory'",{"type":993,"tag":1021,"props":3784,"children":3785},{"style":1048},[3786],{"type":998,"value":2280},{"type":993,"tag":1021,"props":3788,"children":3789},{"style":1057},[3790],{"type":998,"value":3731},{"type":993,"tag":1021,"props":3792,"children":3793},{"style":1048},[3794],{"type":998,"value":3717},{"type":993,"tag":1021,"props":3796,"children":3797},{"style":1057},[3798],{"type":998,"value":3799},"'images'",{"type":993,"tag":1021,"props":3801,"children":3802},{"style":1048},[3803],{"type":998,"value":2280},{"type":993,"tag":1021,"props":3805,"children":3806},{"style":1057},[3807],{"type":998,"value":3644},{"type":993,"tag":1021,"props":3809,"children":3810},{"style":1048},[3811],{"type":998,"value":3812},": [\n",{"type":993,"tag":1021,"props":3814,"children":3815},{"class":1023,"line":173},[3816,3821,3825,3829,3833,3837,3841,3845,3850,3854,3858,3862,3867],{"type":993,"tag":1021,"props":3817,"children":3818},{"style":1048},[3819],{"type":998,"value":3820},"        {",{"type":993,"tag":1021,"props":3822,"children":3823},{"style":1057},[3824],{"type":998,"value":3540},{"type":993,"tag":1021,"props":3826,"children":3827},{"style":1048},[3828],{"type":998,"value":3717},{"type":993,"tag":1021,"props":3830,"children":3831},{"style":1057},[3832],{"type":998,"value":3722},{"type":993,"tag":1021,"props":3834,"children":3835},{"style":1048},[3836],{"type":998,"value":2280},{"type":993,"tag":1021,"props":3838,"children":3839},{"style":1057},[3840],{"type":998,"value":3731},{"type":993,"tag":1021,"props":3842,"children":3843},{"style":1048},[3844],{"type":998,"value":3717},{"type":993,"tag":1021,"props":3846,"children":3847},{"style":1057},[3848],{"type":998,"value":3849},"'photo1.jpg'",{"type":993,"tag":1021,"props":3851,"children":3852},{"style":1048},[3853],{"type":998,"value":2280},{"type":993,"tag":1021,"props":3855,"children":3856},{"style":1057},[3857],{"type":998,"value":3578},{"type":993,"tag":1021,"props":3859,"children":3860},{"style":1048},[3861],{"type":998,"value":3717},{"type":993,"tag":1021,"props":3863,"children":3864},{"style":1089},[3865],{"type":998,"value":3866},"2048",{"type":993,"tag":1021,"props":3868,"children":3869},{"style":1048},[3870],{"type":998,"value":3762},{"type":993,"tag":1021,"props":3872,"children":3873},{"class":1023,"line":182},[3874,3878,3882,3886,3890,3894,3898,3902,3907,3911,3915,3919,3924],{"type":993,"tag":1021,"props":3875,"children":3876},{"style":1048},[3877],{"type":998,"value":3820},{"type":993,"tag":1021,"props":3879,"children":3880},{"style":1057},[3881],{"type":998,"value":3540},{"type":993,"tag":1021,"props":3883,"children":3884},{"style":1048},[3885],{"type":998,"value":3717},{"type":993,"tag":1021,"props":3887,"children":3888},{"style":1057},[3889],{"type":998,"value":3722},{"type":993,"tag":1021,"props":3891,"children":3892},{"style":1048},[3893],{"type":998,"value":2280},{"type":993,"tag":1021,"props":3895,"children":3896},{"style":1057},[3897],{"type":998,"value":3731},{"type":993,"tag":1021,"props":3899,"children":3900},{"style":1048},[3901],{"type":998,"value":3717},{"type":993,"tag":1021,"props":3903,"children":3904},{"style":1057},[3905],{"type":998,"value":3906},"'photo2.jpg'",{"type":993,"tag":1021,"props":3908,"children":3909},{"style":1048},[3910],{"type":998,"value":2280},{"type":993,"tag":1021,"props":3912,"children":3913},{"style":1057},[3914],{"type":998,"value":3578},{"type":993,"tag":1021,"props":3916,"children":3917},{"style":1048},[3918],{"type":998,"value":3717},{"type":993,"tag":1021,"props":3920,"children":3921},{"style":1089},[3922],{"type":998,"value":3923},"1536",{"type":993,"tag":1021,"props":3925,"children":3926},{"style":1048},[3927],{"type":998,"value":3928},"}\n",{"type":993,"tag":1021,"props":3930,"children":3931},{"class":1023,"line":191},[3932],{"type":993,"tag":1021,"props":3933,"children":3934},{"style":1048},[3935],{"type":998,"value":3936},"    ]},\n",{"type":993,"tag":1021,"props":3938,"children":3939},{"class":1023,"line":201},[3940,3944,3948,3952,3956,3960,3964,3968,3973,3977,3981,3985,3990],{"type":993,"tag":1021,"props":3941,"children":3942},{"style":1048},[3943],{"type":998,"value":3708},{"type":993,"tag":1021,"props":3945,"children":3946},{"style":1057},[3947],{"type":998,"value":3540},{"type":993,"tag":1021,"props":3949,"children":3950},{"style":1048},[3951],{"type":998,"value":3717},{"type":993,"tag":1021,"props":3953,"children":3954},{"style":1057},[3955],{"type":998,"value":3722},{"type":993,"tag":1021,"props":3957,"children":3958},{"style":1048},[3959],{"type":998,"value":2280},{"type":993,"tag":1021,"props":3961,"children":3962},{"style":1057},[3963],{"type":998,"value":3731},{"type":993,"tag":1021,"props":3965,"children":3966},{"style":1048},[3967],{"type":998,"value":3717},{"type":993,"tag":1021,"props":3969,"children":3970},{"style":1057},[3971],{"type":998,"value":3972},"'data.csv'",{"type":993,"tag":1021,"props":3974,"children":3975},{"style":1048},[3976],{"type":998,"value":2280},{"type":993,"tag":1021,"props":3978,"children":3979},{"style":1057},[3980],{"type":998,"value":3578},{"type":993,"tag":1021,"props":3982,"children":3983},{"style":1048},[3984],{"type":998,"value":3717},{"type":993,"tag":1021,"props":3986,"children":3987},{"style":1089},[3988],{"type":998,"value":3989},"512",{"type":993,"tag":1021,"props":3991,"children":3992},{"style":1048},[3993],{"type":998,"value":3928},{"type":993,"tag":1021,"props":3995,"children":3996},{"class":1023,"line":210},[3997],{"type":993,"tag":1021,"props":3998,"children":3999},{"style":1048},[4000],{"type":998,"value":2172},{"type":993,"tag":1021,"props":4002,"children":4003},{"class":1023,"line":219},[4004],{"type":993,"tag":1021,"props":4005,"children":4006},{"emptyLinePlaceholder":13},[4007],{"type":998,"value":1170},{"type":993,"tag":1021,"props":4009,"children":4010},{"class":1023,"line":228},[4011,4016,4020],{"type":993,"tag":1021,"props":4012,"children":4013},{"style":1048},[4014],{"type":998,"value":4015},"total ",{"type":993,"tag":1021,"props":4017,"children":4018},{"style":1036},[4019],{"type":998,"value":2200},{"type":993,"tag":1021,"props":4021,"children":4022},{"style":1048},[4023],{"type":998,"value":4024}," calculate_directory_size(file_system)\n",{"type":993,"tag":1021,"props":4026,"children":4027},{"class":1023,"line":238},[4028,4032,4036,4040,4045,4049,4054,4058,4063],{"type":993,"tag":1021,"props":4029,"children":4030},{"style":1089},[4031],{"type":998,"value":1186},{"type":993,"tag":1021,"props":4033,"children":4034},{"style":1048},[4035],{"type":998,"value":1191},{"type":993,"tag":1021,"props":4037,"children":4038},{"style":1036},[4039],{"type":998,"value":1196},{"type":993,"tag":1021,"props":4041,"children":4042},{"style":1057},[4043],{"type":998,"value":4044},"\"Total directory size: ",{"type":993,"tag":1021,"props":4046,"children":4047},{"style":1089},[4048],{"type":998,"value":1206},{"type":993,"tag":1021,"props":4050,"children":4051},{"style":1048},[4052],{"type":998,"value":4053},"total",{"type":993,"tag":1021,"props":4055,"children":4056},{"style":1089},[4057],{"type":998,"value":1226},{"type":993,"tag":1021,"props":4059,"children":4060},{"style":1057},[4061],{"type":998,"value":4062}," bytes\"",{"type":993,"tag":1021,"props":4064,"children":4065},{"style":1048},[4066],{"type":998,"value":1162},{"type":993,"tag":1363,"props":4068,"children":4070},{"id":4069},"mathematical-calculations",[4071],{"type":998,"value":4072},"Mathematical Calculations",{"type":993,"tag":1001,"props":4074,"children":4075},{},[4076],{"type":998,"value":4077},"Recursive functions excel at mathematical problems that have self-similar structure or can be defined in terms of smaller instances.",{"type":993,"tag":1007,"props":4079,"children":4080},{},[4081],{"type":993,"tag":1011,"props":4082,"children":4084},{"className":1013,"code":4083,"language":6,"meta":8,"style":8},"def gcd(a, b):\n    \"\"\"Calculate greatest common divisor using Euclidean algorithm\"\"\"\n    # Base case: when b is 0, GCD is a\n    if b == 0:\n        return a\n    \n    # Recursive case: GCD(a, b) = GCD(b, a % b)\n    return gcd(b, a % b)\n\ndef binary_search(arr, target, left=0, right=None):\n    \"\"\"Search for target in sorted array using recursion\"\"\"\n    if right is None:\n        right = len(arr) - 1\n    \n    # Base case: element not found\n    if left > right:\n        return -1\n    \n    # Find middle point\n    mid = (left + right) // 2\n    \n    # Base case: found the target\n    if arr[mid] == target:\n        return mid\n    \n    # Recursive cases: search left or right half\n    if arr[mid] > target:\n        return binary_search(arr, target, left, mid - 1)\n    else:\n        return binary_search(arr, target, mid + 1, right)\n\n# Test mathematical recursion\nprint(f\"GCD(48, 18) = {gcd(48, 18)}\")\n\nnumbers = [1, 3, 5, 7, 9, 11, 13, 15]\nindex = binary_search(numbers, 7)\nprint(f\"Found 7 at index: {index}\")\n",[4085],{"type":993,"tag":1017,"props":4086,"children":4087},{"__ignoreMap":8},[4088,4105,4113,4121,4145,4157,4164,4172,4194,4201,4244,4252,4278,4307,4314,4322,4344,4361,4368,4376,4412,4419,4427,4448,4460,4467,4475,4494,4518,4530,4555,4562,4570,4629,4636,4719,4744],{"type":993,"tag":1021,"props":4089,"children":4090},{"class":1023,"line":12},[4091,4095,4100],{"type":993,"tag":1021,"props":4092,"children":4093},{"style":1036},[4094],{"type":998,"value":1039},{"type":993,"tag":1021,"props":4096,"children":4097},{"style":1042},[4098],{"type":998,"value":4099}," gcd",{"type":993,"tag":1021,"props":4101,"children":4102},{"style":1048},[4103],{"type":998,"value":4104},"(a, b):\n",{"type":993,"tag":1021,"props":4106,"children":4107},{"class":1023,"line":27},[4108],{"type":993,"tag":1021,"props":4109,"children":4110},{"style":1057},[4111],{"type":998,"value":4112},"    \"\"\"Calculate greatest common divisor using Euclidean algorithm\"\"\"\n",{"type":993,"tag":1021,"props":4114,"children":4115},{"class":1023,"line":36},[4116],{"type":993,"tag":1021,"props":4117,"children":4118},{"style":1027},[4119],{"type":998,"value":4120},"    # Base case: when b is 0, GCD is a\n",{"type":993,"tag":1021,"props":4122,"children":4123},{"class":1023,"line":45},[4124,4128,4133,4137,4141],{"type":993,"tag":1021,"props":4125,"children":4126},{"style":1036},[4127],{"type":998,"value":1076},{"type":993,"tag":1021,"props":4129,"children":4130},{"style":1048},[4131],{"type":998,"value":4132}," b ",{"type":993,"tag":1021,"props":4134,"children":4135},{"style":1036},[4136],{"type":998,"value":1755},{"type":993,"tag":1021,"props":4138,"children":4139},{"style":1089},[4140],{"type":998,"value":1435},{"type":993,"tag":1021,"props":4142,"children":4143},{"style":1048},[4144],{"type":998,"value":1097},{"type":993,"tag":1021,"props":4146,"children":4147},{"class":1023,"line":54},[4148,4152],{"type":993,"tag":1021,"props":4149,"children":4150},{"style":1036},[4151],{"type":998,"value":1105},{"type":993,"tag":1021,"props":4153,"children":4154},{"style":1048},[4155],{"type":998,"value":4156}," a\n",{"type":993,"tag":1021,"props":4158,"children":4159},{"class":1023,"line":63},[4160],{"type":993,"tag":1021,"props":4161,"children":4162},{"style":1048},[4163],{"type":998,"value":1118},{"type":993,"tag":1021,"props":4165,"children":4166},{"class":1023,"line":72},[4167],{"type":993,"tag":1021,"props":4168,"children":4169},{"style":1027},[4170],{"type":998,"value":4171},"    # Recursive case: GCD(a, b) = GCD(b, a % b)\n",{"type":993,"tag":1021,"props":4173,"children":4174},{"class":1023,"line":81},[4175,4179,4184,4189],{"type":993,"tag":1021,"props":4176,"children":4177},{"style":1036},[4178],{"type":998,"value":1134},{"type":993,"tag":1021,"props":4180,"children":4181},{"style":1048},[4182],{"type":998,"value":4183}," gcd(b, a ",{"type":993,"tag":1021,"props":4185,"children":4186},{"style":1036},[4187],{"type":998,"value":4188},"%",{"type":993,"tag":1021,"props":4190,"children":4191},{"style":1048},[4192],{"type":998,"value":4193}," b)\n",{"type":993,"tag":1021,"props":4195,"children":4196},{"class":1023,"line":91},[4197],{"type":993,"tag":1021,"props":4198,"children":4199},{"emptyLinePlaceholder":13},[4200],{"type":998,"value":1170},{"type":993,"tag":1021,"props":4202,"children":4203},{"class":1023,"line":100},[4204,4208,4213,4218,4222,4226,4231,4235,4240],{"type":993,"tag":1021,"props":4205,"children":4206},{"style":1036},[4207],{"type":998,"value":1039},{"type":993,"tag":1021,"props":4209,"children":4210},{"style":1042},[4211],{"type":998,"value":4212}," binary_search",{"type":993,"tag":1021,"props":4214,"children":4215},{"style":1048},[4216],{"type":998,"value":4217},"(arr, target, left",{"type":993,"tag":1021,"props":4219,"children":4220},{"style":1036},[4221],{"type":998,"value":2200},{"type":993,"tag":1021,"props":4223,"children":4224},{"style":1089},[4225],{"type":998,"value":1328},{"type":993,"tag":1021,"props":4227,"children":4228},{"style":1048},[4229],{"type":998,"value":4230},", right",{"type":993,"tag":1021,"props":4232,"children":4233},{"style":1036},[4234],{"type":998,"value":2200},{"type":993,"tag":1021,"props":4236,"children":4237},{"style":1089},[4238],{"type":998,"value":4239},"None",{"type":993,"tag":1021,"props":4241,"children":4242},{"style":1048},[4243],{"type":998,"value":1888},{"type":993,"tag":1021,"props":4245,"children":4246},{"class":1023,"line":109},[4247],{"type":993,"tag":1021,"props":4248,"children":4249},{"style":1057},[4250],{"type":998,"value":4251},"    \"\"\"Search for target in sorted array using recursion\"\"\"\n",{"type":993,"tag":1021,"props":4253,"children":4254},{"class":1023,"line":118},[4255,4259,4264,4269,4274],{"type":993,"tag":1021,"props":4256,"children":4257},{"style":1036},[4258],{"type":998,"value":1076},{"type":993,"tag":1021,"props":4260,"children":4261},{"style":1048},[4262],{"type":998,"value":4263}," right ",{"type":993,"tag":1021,"props":4265,"children":4266},{"style":1036},[4267],{"type":998,"value":4268},"is",{"type":993,"tag":1021,"props":4270,"children":4271},{"style":1089},[4272],{"type":998,"value":4273}," None",{"type":993,"tag":1021,"props":4275,"children":4276},{"style":1048},[4277],{"type":998,"value":1097},{"type":993,"tag":1021,"props":4279,"children":4280},{"class":1023,"line":127},[4281,4286,4290,4294,4299,4303],{"type":993,"tag":1021,"props":4282,"children":4283},{"style":1048},[4284],{"type":998,"value":4285},"        right ",{"type":993,"tag":1021,"props":4287,"children":4288},{"style":1036},[4289],{"type":998,"value":2200},{"type":993,"tag":1021,"props":4291,"children":4292},{"style":1089},[4293],{"type":998,"value":2135},{"type":993,"tag":1021,"props":4295,"children":4296},{"style":1048},[4297],{"type":998,"value":4298},"(arr) ",{"type":993,"tag":1021,"props":4300,"children":4301},{"style":1036},[4302],{"type":998,"value":1153},{"type":993,"tag":1021,"props":4304,"children":4305},{"style":1089},[4306],{"type":998,"value":1110},{"type":993,"tag":1021,"props":4308,"children":4309},{"class":1023,"line":136},[4310],{"type":993,"tag":1021,"props":4311,"children":4312},{"style":1048},[4313],{"type":998,"value":1118},{"type":993,"tag":1021,"props":4315,"children":4316},{"class":1023,"line":146},[4317],{"type":993,"tag":1021,"props":4318,"children":4319},{"style":1027},[4320],{"type":998,"value":4321},"    # Base case: element not found\n",{"type":993,"tag":1021,"props":4323,"children":4324},{"class":1023,"line":155},[4325,4329,4334,4339],{"type":993,"tag":1021,"props":4326,"children":4327},{"style":1036},[4328],{"type":998,"value":1076},{"type":993,"tag":1021,"props":4330,"children":4331},{"style":1048},[4332],{"type":998,"value":4333}," left ",{"type":993,"tag":1021,"props":4335,"children":4336},{"style":1036},[4337],{"type":998,"value":4338},">",{"type":993,"tag":1021,"props":4340,"children":4341},{"style":1048},[4342],{"type":998,"value":4343}," right:\n",{"type":993,"tag":1021,"props":4345,"children":4346},{"class":1023,"line":164},[4347,4351,4356],{"type":993,"tag":1021,"props":4348,"children":4349},{"style":1036},[4350],{"type":998,"value":1105},{"type":993,"tag":1021,"props":4352,"children":4353},{"style":1036},[4354],{"type":998,"value":4355}," -",{"type":993,"tag":1021,"props":4357,"children":4358},{"style":1089},[4359],{"type":998,"value":4360},"1\n",{"type":993,"tag":1021,"props":4362,"children":4363},{"class":1023,"line":173},[4364],{"type":993,"tag":1021,"props":4365,"children":4366},{"style":1048},[4367],{"type":998,"value":1118},{"type":993,"tag":1021,"props":4369,"children":4370},{"class":1023,"line":182},[4371],{"type":993,"tag":1021,"props":4372,"children":4373},{"style":1027},[4374],{"type":998,"value":4375},"    # Find middle point\n",{"type":993,"tag":1021,"props":4377,"children":4378},{"class":1023,"line":191},[4379,4384,4388,4393,4397,4402,4407],{"type":993,"tag":1021,"props":4380,"children":4381},{"style":1048},[4382],{"type":998,"value":4383},"    mid ",{"type":993,"tag":1021,"props":4385,"children":4386},{"style":1036},[4387],{"type":998,"value":2200},{"type":993,"tag":1021,"props":4389,"children":4390},{"style":1048},[4391],{"type":998,"value":4392}," (left ",{"type":993,"tag":1021,"props":4394,"children":4395},{"style":1036},[4396],{"type":998,"value":1819},{"type":993,"tag":1021,"props":4398,"children":4399},{"style":1048},[4400],{"type":998,"value":4401}," right) ",{"type":993,"tag":1021,"props":4403,"children":4404},{"style":1036},[4405],{"type":998,"value":4406},"//",{"type":993,"tag":1021,"props":4408,"children":4409},{"style":1089},[4410],{"type":998,"value":4411}," 2\n",{"type":993,"tag":1021,"props":4413,"children":4414},{"class":1023,"line":201},[4415],{"type":993,"tag":1021,"props":4416,"children":4417},{"style":1048},[4418],{"type":998,"value":1118},{"type":993,"tag":1021,"props":4420,"children":4421},{"class":1023,"line":210},[4422],{"type":993,"tag":1021,"props":4423,"children":4424},{"style":1027},[4425],{"type":998,"value":4426},"    # Base case: found the target\n",{"type":993,"tag":1021,"props":4428,"children":4429},{"class":1023,"line":219},[4430,4434,4439,4443],{"type":993,"tag":1021,"props":4431,"children":4432},{"style":1036},[4433],{"type":998,"value":1076},{"type":993,"tag":1021,"props":4435,"children":4436},{"style":1048},[4437],{"type":998,"value":4438}," arr[mid] ",{"type":993,"tag":1021,"props":4440,"children":4441},{"style":1036},[4442],{"type":998,"value":1755},{"type":993,"tag":1021,"props":4444,"children":4445},{"style":1048},[4446],{"type":998,"value":4447}," target:\n",{"type":993,"tag":1021,"props":4449,"children":4450},{"class":1023,"line":228},[4451,4455],{"type":993,"tag":1021,"props":4452,"children":4453},{"style":1036},[4454],{"type":998,"value":1105},{"type":993,"tag":1021,"props":4456,"children":4457},{"style":1048},[4458],{"type":998,"value":4459}," mid\n",{"type":993,"tag":1021,"props":4461,"children":4462},{"class":1023,"line":238},[4463],{"type":993,"tag":1021,"props":4464,"children":4465},{"style":1048},[4466],{"type":998,"value":1118},{"type":993,"tag":1021,"props":4468,"children":4469},{"class":1023,"line":247},[4470],{"type":993,"tag":1021,"props":4471,"children":4472},{"style":1027},[4473],{"type":998,"value":4474},"    # Recursive cases: search left or right half\n",{"type":993,"tag":1021,"props":4476,"children":4477},{"class":1023,"line":256},[4478,4482,4486,4490],{"type":993,"tag":1021,"props":4479,"children":4480},{"style":1036},[4481],{"type":998,"value":1076},{"type":993,"tag":1021,"props":4483,"children":4484},{"style":1048},[4485],{"type":998,"value":4438},{"type":993,"tag":1021,"props":4487,"children":4488},{"style":1036},[4489],{"type":998,"value":4338},{"type":993,"tag":1021,"props":4491,"children":4492},{"style":1048},[4493],{"type":998,"value":4447},{"type":993,"tag":1021,"props":4495,"children":4496},{"class":1023,"line":265},[4497,4501,4506,4510,4514],{"type":993,"tag":1021,"props":4498,"children":4499},{"style":1036},[4500],{"type":998,"value":1105},{"type":993,"tag":1021,"props":4502,"children":4503},{"style":1048},[4504],{"type":998,"value":4505}," binary_search(arr, target, left, mid ",{"type":993,"tag":1021,"props":4507,"children":4508},{"style":1036},[4509],{"type":998,"value":1153},{"type":993,"tag":1021,"props":4511,"children":4512},{"style":1089},[4513],{"type":998,"value":1092},{"type":993,"tag":1021,"props":4515,"children":4516},{"style":1048},[4517],{"type":998,"value":1162},{"type":993,"tag":1021,"props":4519,"children":4520},{"class":1023,"line":274},[4521,4526],{"type":993,"tag":1021,"props":4522,"children":4523},{"style":1036},[4524],{"type":998,"value":4525},"    else",{"type":993,"tag":1021,"props":4527,"children":4528},{"style":1048},[4529],{"type":998,"value":1097},{"type":993,"tag":1021,"props":4531,"children":4532},{"class":1023,"line":284},[4533,4537,4542,4546,4550],{"type":993,"tag":1021,"props":4534,"children":4535},{"style":1036},[4536],{"type":998,"value":1105},{"type":993,"tag":1021,"props":4538,"children":4539},{"style":1048},[4540],{"type":998,"value":4541}," binary_search(arr, target, mid ",{"type":993,"tag":1021,"props":4543,"children":4544},{"style":1036},[4545],{"type":998,"value":1819},{"type":993,"tag":1021,"props":4547,"children":4548},{"style":1089},[4549],{"type":998,"value":1092},{"type":993,"tag":1021,"props":4551,"children":4552},{"style":1048},[4553],{"type":998,"value":4554},", right)\n",{"type":993,"tag":1021,"props":4556,"children":4557},{"class":1023,"line":293},[4558],{"type":993,"tag":1021,"props":4559,"children":4560},{"emptyLinePlaceholder":13},[4561],{"type":998,"value":1170},{"type":993,"tag":1021,"props":4563,"children":4564},{"class":1023,"line":302},[4565],{"type":993,"tag":1021,"props":4566,"children":4567},{"style":1027},[4568],{"type":998,"value":4569},"# Test mathematical recursion\n",{"type":993,"tag":1021,"props":4571,"children":4572},{"class":1023,"line":311},[4573,4577,4581,4585,4590,4594,4599,4604,4608,4613,4617,4621,4625],{"type":993,"tag":1021,"props":4574,"children":4575},{"style":1089},[4576],{"type":998,"value":1186},{"type":993,"tag":1021,"props":4578,"children":4579},{"style":1048},[4580],{"type":998,"value":1191},{"type":993,"tag":1021,"props":4582,"children":4583},{"style":1036},[4584],{"type":998,"value":1196},{"type":993,"tag":1021,"props":4586,"children":4587},{"style":1057},[4588],{"type":998,"value":4589},"\"GCD(48, 18) = ",{"type":993,"tag":1021,"props":4591,"children":4592},{"style":1089},[4593],{"type":998,"value":1206},{"type":993,"tag":1021,"props":4595,"children":4596},{"style":1048},[4597],{"type":998,"value":4598},"gcd(",{"type":993,"tag":1021,"props":4600,"children":4601},{"style":1089},[4602],{"type":998,"value":4603},"48",{"type":993,"tag":1021,"props":4605,"children":4606},{"style":1048},[4607],{"type":998,"value":2280},{"type":993,"tag":1021,"props":4609,"children":4610},{"style":1089},[4611],{"type":998,"value":4612},"18",{"type":993,"tag":1021,"props":4614,"children":4615},{"style":1048},[4616],{"type":998,"value":1221},{"type":993,"tag":1021,"props":4618,"children":4619},{"style":1089},[4620],{"type":998,"value":1226},{"type":993,"tag":1021,"props":4622,"children":4623},{"style":1057},[4624],{"type":998,"value":1231},{"type":993,"tag":1021,"props":4626,"children":4627},{"style":1048},[4628],{"type":998,"value":1162},{"type":993,"tag":1021,"props":4630,"children":4631},{"class":1023,"line":320},[4632],{"type":993,"tag":1021,"props":4633,"children":4634},{"emptyLinePlaceholder":13},[4635],{"type":998,"value":1170},{"type":993,"tag":1021,"props":4637,"children":4638},{"class":1023,"line":329},[4639,4644,4648,4652,4656,4660,4664,4668,4672,4676,4680,4684,4688,4692,4697,4701,4706,4710,4715],{"type":993,"tag":1021,"props":4640,"children":4641},{"style":1048},[4642],{"type":998,"value":4643},"numbers ",{"type":993,"tag":1021,"props":4645,"children":4646},{"style":1036},[4647],{"type":998,"value":2200},{"type":993,"tag":1021,"props":4649,"children":4650},{"style":1048},[4651],{"type":998,"value":2271},{"type":993,"tag":1021,"props":4653,"children":4654},{"style":1089},[4655],{"type":998,"value":2079},{"type":993,"tag":1021,"props":4657,"children":4658},{"style":1048},[4659],{"type":998,"value":2280},{"type":993,"tag":1021,"props":4661,"children":4662},{"style":1089},[4663],{"type":998,"value":1274},{"type":993,"tag":1021,"props":4665,"children":4666},{"style":1048},[4667],{"type":998,"value":2280},{"type":993,"tag":1021,"props":4669,"children":4670},{"style":1089},[4671],{"type":998,"value":1216},{"type":993,"tag":1021,"props":4673,"children":4674},{"style":1048},[4675],{"type":998,"value":2280},{"type":993,"tag":1021,"props":4677,"children":4678},{"style":1089},[4679],{"type":998,"value":2285},{"type":993,"tag":1021,"props":4681,"children":4682},{"style":1048},[4683],{"type":998,"value":2280},{"type":993,"tag":1021,"props":4685,"children":4686},{"style":1089},[4687],{"type":998,"value":2303},{"type":993,"tag":1021,"props":4689,"children":4690},{"style":1048},[4691],{"type":998,"value":2280},{"type":993,"tag":1021,"props":4693,"children":4694},{"style":1089},[4695],{"type":998,"value":4696},"11",{"type":993,"tag":1021,"props":4698,"children":4699},{"style":1048},[4700],{"type":998,"value":2280},{"type":993,"tag":1021,"props":4702,"children":4703},{"style":1089},[4704],{"type":998,"value":4705},"13",{"type":993,"tag":1021,"props":4707,"children":4708},{"style":1048},[4709],{"type":998,"value":2280},{"type":993,"tag":1021,"props":4711,"children":4712},{"style":1089},[4713],{"type":998,"value":4714},"15",{"type":993,"tag":1021,"props":4716,"children":4717},{"style":1048},[4718],{"type":998,"value":2172},{"type":993,"tag":1021,"props":4720,"children":4721},{"class":1023,"line":338},[4722,4727,4731,4736,4740],{"type":993,"tag":1021,"props":4723,"children":4724},{"style":1048},[4725],{"type":998,"value":4726},"index ",{"type":993,"tag":1021,"props":4728,"children":4729},{"style":1036},[4730],{"type":998,"value":2200},{"type":993,"tag":1021,"props":4732,"children":4733},{"style":1048},[4734],{"type":998,"value":4735}," binary_search(numbers, ",{"type":993,"tag":1021,"props":4737,"children":4738},{"style":1089},[4739],{"type":998,"value":2285},{"type":993,"tag":1021,"props":4741,"children":4742},{"style":1048},[4743],{"type":998,"value":1162},{"type":993,"tag":1021,"props":4745,"children":4746},{"class":1023,"line":347},[4747,4751,4755,4759,4764,4768,4773,4777,4781],{"type":993,"tag":1021,"props":4748,"children":4749},{"style":1089},[4750],{"type":998,"value":1186},{"type":993,"tag":1021,"props":4752,"children":4753},{"style":1048},[4754],{"type":998,"value":1191},{"type":993,"tag":1021,"props":4756,"children":4757},{"style":1036},[4758],{"type":998,"value":1196},{"type":993,"tag":1021,"props":4760,"children":4761},{"style":1057},[4762],{"type":998,"value":4763},"\"Found 7 at index: ",{"type":993,"tag":1021,"props":4765,"children":4766},{"style":1089},[4767],{"type":998,"value":1206},{"type":993,"tag":1021,"props":4769,"children":4770},{"style":1048},[4771],{"type":998,"value":4772},"index",{"type":993,"tag":1021,"props":4774,"children":4775},{"style":1089},[4776],{"type":998,"value":1226},{"type":993,"tag":1021,"props":4778,"children":4779},{"style":1057},[4780],{"type":998,"value":1231},{"type":993,"tag":1021,"props":4782,"children":4783},{"style":1048},[4784],{"type":998,"value":1162},{"type":993,"tag":1351,"props":4786,"children":4788},{"id":4787},"recursion-best-practices",[4789],{"type":998,"value":4790},"📚 Recursion Best Practices",{"type":993,"tag":1583,"props":4792,"children":4796},{"emoji":4793,"title":4794,"type":4795},"⚠️","Common Pitfalls","warning",[4797,4807,4817,4827,4837],{"type":993,"tag":1001,"props":4798,"children":4799},{},[4800,4805],{"type":993,"tag":1593,"props":4801,"children":4802},{},[4803],{"type":998,"value":4804},"Infinite Recursion:",{"type":998,"value":4806}," Always ensure your base case is reachable and stops recursion.",{"type":993,"tag":1001,"props":4808,"children":4809},{},[4810,4815],{"type":993,"tag":1593,"props":4811,"children":4812},{},[4813],{"type":998,"value":4814},"Stack Overflow:",{"type":998,"value":4816}," Deep recursion can exceed Python's call stack limit (~1000 calls).",{"type":993,"tag":1001,"props":4818,"children":4819},{},[4820,4825],{"type":993,"tag":1593,"props":4821,"children":4822},{},[4823],{"type":998,"value":4824},"Performance Issues:",{"type":998,"value":4826}," Some recursive algorithms repeat calculations unnecessarily.",{"type":993,"tag":1001,"props":4828,"children":4829},{},[4830,4835],{"type":993,"tag":1593,"props":4831,"children":4832},{},[4833],{"type":998,"value":4834},"Memory Usage:",{"type":998,"value":4836}," Each recursive call consumes stack memory until it returns.",{"type":993,"tag":1001,"props":4838,"children":4839},{},[4840,4845],{"type":993,"tag":1593,"props":4841,"children":4842},{},[4843],{"type":998,"value":4844},"Debugging Difficulty:",{"type":998,"value":4846}," Recursive functions can be harder to trace and debug.",{"type":993,"tag":1363,"props":4848,"children":4850},{"id":4849},"when-to-use-recursion",[4851],{"type":998,"value":4852},"When to Use Recursion",{"type":993,"tag":1007,"props":4854,"children":4855},{},[4856],{"type":993,"tag":1011,"props":4857,"children":4859},{"className":1013,"code":4858,"language":6,"meta":8,"style":8},"# Good recursion candidates\ndef calculate_tree_height(node):\n    \"\"\"Calculate height of a tree structure\"\"\"\n    if not node or not node.get('children'):\n        return 0\n    \n    # Height is 1 + maximum height of children\n    child_heights = [calculate_tree_height(child) for child in node['children']]\n    return 1 + max(child_heights)\n\n# Simulate tree structure\ntree = {\n    'name': 'root',\n    'children': [\n        {'name': 'child1', 'children': [\n            {'name': 'grandchild1'},\n            {'name': 'grandchild2'}\n        ]},\n        {'name': 'child2'}\n    ]\n}\n\nheight = calculate_tree_height(tree)\nprint(f\"Tree height: {height}\")\n",[4860],{"type":993,"tag":1017,"props":4861,"children":4862},{"__ignoreMap":8},[4863,4871,4888,4896,4935,4946,4953,4961,5005,5030,5037,5045,5062,5084,5096,5128,5153,5177,5185,5209,5217,5224,5231,5248],{"type":993,"tag":1021,"props":4864,"children":4865},{"class":1023,"line":12},[4866],{"type":993,"tag":1021,"props":4867,"children":4868},{"style":1027},[4869],{"type":998,"value":4870},"# Good recursion candidates\n",{"type":993,"tag":1021,"props":4872,"children":4873},{"class":1023,"line":27},[4874,4878,4883],{"type":993,"tag":1021,"props":4875,"children":4876},{"style":1036},[4877],{"type":998,"value":1039},{"type":993,"tag":1021,"props":4879,"children":4880},{"style":1042},[4881],{"type":998,"value":4882}," calculate_tree_height",{"type":993,"tag":1021,"props":4884,"children":4885},{"style":1048},[4886],{"type":998,"value":4887},"(node):\n",{"type":993,"tag":1021,"props":4889,"children":4890},{"class":1023,"line":36},[4891],{"type":993,"tag":1021,"props":4892,"children":4893},{"style":1057},[4894],{"type":998,"value":4895},"    \"\"\"Calculate height of a tree structure\"\"\"\n",{"type":993,"tag":1021,"props":4897,"children":4898},{"class":1023,"line":45},[4899,4903,4907,4912,4917,4921,4926,4931],{"type":993,"tag":1021,"props":4900,"children":4901},{"style":1036},[4902],{"type":998,"value":1076},{"type":993,"tag":1021,"props":4904,"children":4905},{"style":1036},[4906],{"type":998,"value":2013},{"type":993,"tag":1021,"props":4908,"children":4909},{"style":1048},[4910],{"type":998,"value":4911}," node ",{"type":993,"tag":1021,"props":4913,"children":4914},{"style":1036},[4915],{"type":998,"value":4916},"or",{"type":993,"tag":1021,"props":4918,"children":4919},{"style":1036},[4920],{"type":998,"value":2013},{"type":993,"tag":1021,"props":4922,"children":4923},{"style":1048},[4924],{"type":998,"value":4925}," node.get(",{"type":993,"tag":1021,"props":4927,"children":4928},{"style":1057},[4929],{"type":998,"value":4930},"'children'",{"type":993,"tag":1021,"props":4932,"children":4933},{"style":1048},[4934],{"type":998,"value":1888},{"type":993,"tag":1021,"props":4936,"children":4937},{"class":1023,"line":54},[4938,4942],{"type":993,"tag":1021,"props":4939,"children":4940},{"style":1036},[4941],{"type":998,"value":1105},{"type":993,"tag":1021,"props":4943,"children":4944},{"style":1089},[4945],{"type":998,"value":1738},{"type":993,"tag":1021,"props":4947,"children":4948},{"class":1023,"line":63},[4949],{"type":993,"tag":1021,"props":4950,"children":4951},{"style":1048},[4952],{"type":998,"value":1118},{"type":993,"tag":1021,"props":4954,"children":4955},{"class":1023,"line":72},[4956],{"type":993,"tag":1021,"props":4957,"children":4958},{"style":1027},[4959],{"type":998,"value":4960},"    # Height is 1 + maximum height of children\n",{"type":993,"tag":1021,"props":4962,"children":4963},{"class":1023,"line":81},[4964,4969,4973,4978,4982,4987,4991,4996,5000],{"type":993,"tag":1021,"props":4965,"children":4966},{"style":1048},[4967],{"type":998,"value":4968},"    child_heights ",{"type":993,"tag":1021,"props":4970,"children":4971},{"style":1036},[4972],{"type":998,"value":2200},{"type":993,"tag":1021,"props":4974,"children":4975},{"style":1048},[4976],{"type":998,"value":4977}," [calculate_tree_height(child) ",{"type":993,"tag":1021,"props":4979,"children":4980},{"style":1036},[4981],{"type":998,"value":1859},{"type":993,"tag":1021,"props":4983,"children":4984},{"style":1048},[4985],{"type":998,"value":4986}," child ",{"type":993,"tag":1021,"props":4988,"children":4989},{"style":1036},[4990],{"type":998,"value":1869},{"type":993,"tag":1021,"props":4992,"children":4993},{"style":1048},[4994],{"type":998,"value":4995}," node[",{"type":993,"tag":1021,"props":4997,"children":4998},{"style":1057},[4999],{"type":998,"value":4930},{"type":993,"tag":1021,"props":5001,"children":5002},{"style":1048},[5003],{"type":998,"value":5004},"]]\n",{"type":993,"tag":1021,"props":5006,"children":5007},{"class":1023,"line":91},[5008,5012,5016,5021,5025],{"type":993,"tag":1021,"props":5009,"children":5010},{"style":1036},[5011],{"type":998,"value":1134},{"type":993,"tag":1021,"props":5013,"children":5014},{"style":1089},[5015],{"type":998,"value":1092},{"type":993,"tag":1021,"props":5017,"children":5018},{"style":1036},[5019],{"type":998,"value":5020}," +",{"type":993,"tag":1021,"props":5022,"children":5023},{"style":1089},[5024],{"type":998,"value":2225},{"type":993,"tag":1021,"props":5026,"children":5027},{"style":1048},[5028],{"type":998,"value":5029},"(child_heights)\n",{"type":993,"tag":1021,"props":5031,"children":5032},{"class":1023,"line":100},[5033],{"type":993,"tag":1021,"props":5034,"children":5035},{"emptyLinePlaceholder":13},[5036],{"type":998,"value":1170},{"type":993,"tag":1021,"props":5038,"children":5039},{"class":1023,"line":109},[5040],{"type":993,"tag":1021,"props":5041,"children":5042},{"style":1027},[5043],{"type":998,"value":5044},"# Simulate tree structure\n",{"type":993,"tag":1021,"props":5046,"children":5047},{"class":1023,"line":118},[5048,5053,5057],{"type":993,"tag":1021,"props":5049,"children":5050},{"style":1048},[5051],{"type":998,"value":5052},"tree ",{"type":993,"tag":1021,"props":5054,"children":5055},{"style":1036},[5056],{"type":998,"value":2200},{"type":993,"tag":1021,"props":5058,"children":5059},{"style":1048},[5060],{"type":998,"value":5061}," {\n",{"type":993,"tag":1021,"props":5063,"children":5064},{"class":1023,"line":127},[5065,5070,5074,5079],{"type":993,"tag":1021,"props":5066,"children":5067},{"style":1057},[5068],{"type":998,"value":5069},"    'name'",{"type":993,"tag":1021,"props":5071,"children":5072},{"style":1048},[5073],{"type":998,"value":3717},{"type":993,"tag":1021,"props":5075,"children":5076},{"style":1057},[5077],{"type":998,"value":5078},"'root'",{"type":993,"tag":1021,"props":5080,"children":5081},{"style":1048},[5082],{"type":998,"value":5083},",\n",{"type":993,"tag":1021,"props":5085,"children":5086},{"class":1023,"line":136},[5087,5092],{"type":993,"tag":1021,"props":5088,"children":5089},{"style":1057},[5090],{"type":998,"value":5091},"    'children'",{"type":993,"tag":1021,"props":5093,"children":5094},{"style":1048},[5095],{"type":998,"value":3812},{"type":993,"tag":1021,"props":5097,"children":5098},{"class":1023,"line":146},[5099,5103,5107,5111,5116,5120,5124],{"type":993,"tag":1021,"props":5100,"children":5101},{"style":1048},[5102],{"type":998,"value":3820},{"type":993,"tag":1021,"props":5104,"children":5105},{"style":1057},[5106],{"type":998,"value":3731},{"type":993,"tag":1021,"props":5108,"children":5109},{"style":1048},[5110],{"type":998,"value":3717},{"type":993,"tag":1021,"props":5112,"children":5113},{"style":1057},[5114],{"type":998,"value":5115},"'child1'",{"type":993,"tag":1021,"props":5117,"children":5118},{"style":1048},[5119],{"type":998,"value":2280},{"type":993,"tag":1021,"props":5121,"children":5122},{"style":1057},[5123],{"type":998,"value":4930},{"type":993,"tag":1021,"props":5125,"children":5126},{"style":1048},[5127],{"type":998,"value":3812},{"type":993,"tag":1021,"props":5129,"children":5130},{"class":1023,"line":155},[5131,5136,5140,5144,5149],{"type":993,"tag":1021,"props":5132,"children":5133},{"style":1048},[5134],{"type":998,"value":5135},"            {",{"type":993,"tag":1021,"props":5137,"children":5138},{"style":1057},[5139],{"type":998,"value":3731},{"type":993,"tag":1021,"props":5141,"children":5142},{"style":1048},[5143],{"type":998,"value":3717},{"type":993,"tag":1021,"props":5145,"children":5146},{"style":1057},[5147],{"type":998,"value":5148},"'grandchild1'",{"type":993,"tag":1021,"props":5150,"children":5151},{"style":1048},[5152],{"type":998,"value":3762},{"type":993,"tag":1021,"props":5154,"children":5155},{"class":1023,"line":164},[5156,5160,5164,5168,5173],{"type":993,"tag":1021,"props":5157,"children":5158},{"style":1048},[5159],{"type":998,"value":5135},{"type":993,"tag":1021,"props":5161,"children":5162},{"style":1057},[5163],{"type":998,"value":3731},{"type":993,"tag":1021,"props":5165,"children":5166},{"style":1048},[5167],{"type":998,"value":3717},{"type":993,"tag":1021,"props":5169,"children":5170},{"style":1057},[5171],{"type":998,"value":5172},"'grandchild2'",{"type":993,"tag":1021,"props":5174,"children":5175},{"style":1048},[5176],{"type":998,"value":3928},{"type":993,"tag":1021,"props":5178,"children":5179},{"class":1023,"line":173},[5180],{"type":993,"tag":1021,"props":5181,"children":5182},{"style":1048},[5183],{"type":998,"value":5184},"        ]},\n",{"type":993,"tag":1021,"props":5186,"children":5187},{"class":1023,"line":182},[5188,5192,5196,5200,5205],{"type":993,"tag":1021,"props":5189,"children":5190},{"style":1048},[5191],{"type":998,"value":3820},{"type":993,"tag":1021,"props":5193,"children":5194},{"style":1057},[5195],{"type":998,"value":3731},{"type":993,"tag":1021,"props":5197,"children":5198},{"style":1048},[5199],{"type":998,"value":3717},{"type":993,"tag":1021,"props":5201,"children":5202},{"style":1057},[5203],{"type":998,"value":5204},"'child2'",{"type":993,"tag":1021,"props":5206,"children":5207},{"style":1048},[5208],{"type":998,"value":3928},{"type":993,"tag":1021,"props":5210,"children":5211},{"class":1023,"line":191},[5212],{"type":993,"tag":1021,"props":5213,"children":5214},{"style":1048},[5215],{"type":998,"value":5216},"    ]\n",{"type":993,"tag":1021,"props":5218,"children":5219},{"class":1023,"line":201},[5220],{"type":993,"tag":1021,"props":5221,"children":5222},{"style":1048},[5223],{"type":998,"value":3928},{"type":993,"tag":1021,"props":5225,"children":5226},{"class":1023,"line":210},[5227],{"type":993,"tag":1021,"props":5228,"children":5229},{"emptyLinePlaceholder":13},[5230],{"type":998,"value":1170},{"type":993,"tag":1021,"props":5232,"children":5233},{"class":1023,"line":219},[5234,5239,5243],{"type":993,"tag":1021,"props":5235,"children":5236},{"style":1048},[5237],{"type":998,"value":5238},"height ",{"type":993,"tag":1021,"props":5240,"children":5241},{"style":1036},[5242],{"type":998,"value":2200},{"type":993,"tag":1021,"props":5244,"children":5245},{"style":1048},[5246],{"type":998,"value":5247}," calculate_tree_height(tree)\n",{"type":993,"tag":1021,"props":5249,"children":5250},{"class":1023,"line":228},[5251,5255,5259,5263,5268,5272,5277,5281,5285],{"type":993,"tag":1021,"props":5252,"children":5253},{"style":1089},[5254],{"type":998,"value":1186},{"type":993,"tag":1021,"props":5256,"children":5257},{"style":1048},[5258],{"type":998,"value":1191},{"type":993,"tag":1021,"props":5260,"children":5261},{"style":1036},[5262],{"type":998,"value":1196},{"type":993,"tag":1021,"props":5264,"children":5265},{"style":1057},[5266],{"type":998,"value":5267},"\"Tree height: ",{"type":993,"tag":1021,"props":5269,"children":5270},{"style":1089},[5271],{"type":998,"value":1206},{"type":993,"tag":1021,"props":5273,"children":5274},{"style":1048},[5275],{"type":998,"value":5276},"height",{"type":993,"tag":1021,"props":5278,"children":5279},{"style":1089},[5280],{"type":998,"value":1226},{"type":993,"tag":1021,"props":5282,"children":5283},{"style":1057},[5284],{"type":998,"value":1231},{"type":993,"tag":1021,"props":5286,"children":5287},{"style":1048},[5288],{"type":998,"value":1162},{"type":993,"tag":1583,"props":5290,"children":5294},{"emoji":5291,"title":5292,"type":5293},"✅","Best Practices","success",[5295,5305,5315,5325,5335],{"type":993,"tag":1001,"props":5296,"children":5297},{},[5298,5303],{"type":993,"tag":1593,"props":5299,"children":5300},{},[5301],{"type":998,"value":5302},"Clear Base Cases:",{"type":998,"value":5304}," Define stopping conditions that are easy to understand and verify.",{"type":993,"tag":1001,"props":5306,"children":5307},{},[5308,5313],{"type":993,"tag":1593,"props":5309,"children":5310},{},[5311],{"type":998,"value":5312},"Progress Toward Base:",{"type":998,"value":5314}," Ensure each recursive call moves closer to the base case.",{"type":993,"tag":1001,"props":5316,"children":5317},{},[5318,5323],{"type":993,"tag":1593,"props":5319,"children":5320},{},[5321],{"type":998,"value":5322},"Consider Alternatives:",{"type":998,"value":5324}," Use iteration for simple counting or accumulation problems.",{"type":993,"tag":1001,"props":5326,"children":5327},{},[5328,5333],{"type":993,"tag":1593,"props":5329,"children":5330},{},[5331],{"type":998,"value":5332},"Optimize When Needed:",{"type":998,"value":5334}," Use memoization for recursive functions with repeated calculations.",{"type":993,"tag":1001,"props":5336,"children":5337},{},[5338,5343],{"type":993,"tag":1593,"props":5339,"children":5340},{},[5341],{"type":998,"value":5342},"Test Thoroughly:",{"type":998,"value":5344}," Verify base cases and edge conditions work correctly.",{"type":993,"tag":5346,"props":5347,"children":5349},"content-exercise",{":widget-view":5348,"category":6,"id":665},"true",[],{"type":993,"tag":5351,"props":5352,"children":5355},"exercise",{"hint":5353,"prompt":5354},"Base case: factorial(0) = 1, recursive case: factorial(n) = n * factorial(n-1)","Create a recursive function to calculate the factorial of a number. Remember that factorial of n is n * factorial of (n-1), and factorial of 0 is 1.",[5356],{"type":993,"tag":1011,"props":5357,"children":5359},{"className":1013,"code":5358,"language":6,"meta":8,"style":8},"def factorial(n):\n    # TODO: Add base case for n = 0\n    # TODO: Add recursive case for n > 0\n    pass\n\n# TODO: Test your function\nresult = factorial(5)\nprint(f\"Factorial of 5 is: {result}\")\n\n# TODO: Test with a few more numbers\nprint(f\"Factorial of 0: {factorial(0)}\")\nprint(f\"Factorial of 3: {factorial(3)}\")\n",[5360],{"type":993,"tag":1017,"props":5361,"children":5362},{"__ignoreMap":8},[5363,5378,5396,5412,5420,5427,5444,5469,5510,5517,5533,5581],{"type":993,"tag":1021,"props":5364,"children":5365},{"class":1023,"line":12},[5366,5370,5374],{"type":993,"tag":1021,"props":5367,"children":5368},{"style":1036},[5369],{"type":998,"value":1039},{"type":993,"tag":1021,"props":5371,"children":5372},{"style":1042},[5373],{"type":998,"value":1045},{"type":993,"tag":1021,"props":5375,"children":5376},{"style":1048},[5377],{"type":998,"value":1051},{"type":993,"tag":1021,"props":5379,"children":5380},{"class":1023,"line":27},[5381,5386,5391],{"type":993,"tag":1021,"props":5382,"children":5383},{"style":1027},[5384],{"type":998,"value":5385},"    # ",{"type":993,"tag":1021,"props":5387,"children":5388},{"style":1036},[5389],{"type":998,"value":5390},"TODO",{"type":993,"tag":1021,"props":5392,"children":5393},{"style":1027},[5394],{"type":998,"value":5395},": Add base case for n = 0\n",{"type":993,"tag":1021,"props":5397,"children":5398},{"class":1023,"line":36},[5399,5403,5407],{"type":993,"tag":1021,"props":5400,"children":5401},{"style":1027},[5402],{"type":998,"value":5385},{"type":993,"tag":1021,"props":5404,"children":5405},{"style":1036},[5406],{"type":998,"value":5390},{"type":993,"tag":1021,"props":5408,"children":5409},{"style":1027},[5410],{"type":998,"value":5411},": Add recursive case for n > 0\n",{"type":993,"tag":1021,"props":5413,"children":5414},{"class":1023,"line":45},[5415],{"type":993,"tag":1021,"props":5416,"children":5417},{"style":1036},[5418],{"type":998,"value":5419},"    pass\n",{"type":993,"tag":1021,"props":5421,"children":5422},{"class":1023,"line":54},[5423],{"type":993,"tag":1021,"props":5424,"children":5425},{"emptyLinePlaceholder":13},[5426],{"type":998,"value":1170},{"type":993,"tag":1021,"props":5428,"children":5429},{"class":1023,"line":63},[5430,5435,5439],{"type":993,"tag":1021,"props":5431,"children":5432},{"style":1027},[5433],{"type":998,"value":5434},"# ",{"type":993,"tag":1021,"props":5436,"children":5437},{"style":1036},[5438],{"type":998,"value":5390},{"type":993,"tag":1021,"props":5440,"children":5441},{"style":1027},[5442],{"type":998,"value":5443},": Test your function\n",{"type":993,"tag":1021,"props":5445,"children":5446},{"class":1023,"line":72},[5447,5452,5456,5461,5465],{"type":993,"tag":1021,"props":5448,"children":5449},{"style":1048},[5450],{"type":998,"value":5451},"result ",{"type":993,"tag":1021,"props":5453,"children":5454},{"style":1036},[5455],{"type":998,"value":2200},{"type":993,"tag":1021,"props":5457,"children":5458},{"style":1048},[5459],{"type":998,"value":5460}," factorial(",{"type":993,"tag":1021,"props":5462,"children":5463},{"style":1089},[5464],{"type":998,"value":1216},{"type":993,"tag":1021,"props":5466,"children":5467},{"style":1048},[5468],{"type":998,"value":1162},{"type":993,"tag":1021,"props":5470,"children":5471},{"class":1023,"line":81},[5472,5476,5480,5484,5489,5493,5498,5502,5506],{"type":993,"tag":1021,"props":5473,"children":5474},{"style":1089},[5475],{"type":998,"value":1186},{"type":993,"tag":1021,"props":5477,"children":5478},{"style":1048},[5479],{"type":998,"value":1191},{"type":993,"tag":1021,"props":5481,"children":5482},{"style":1036},[5483],{"type":998,"value":1196},{"type":993,"tag":1021,"props":5485,"children":5486},{"style":1057},[5487],{"type":998,"value":5488},"\"Factorial of 5 is: ",{"type":993,"tag":1021,"props":5490,"children":5491},{"style":1089},[5492],{"type":998,"value":1206},{"type":993,"tag":1021,"props":5494,"children":5495},{"style":1048},[5496],{"type":998,"value":5497},"result",{"type":993,"tag":1021,"props":5499,"children":5500},{"style":1089},[5501],{"type":998,"value":1226},{"type":993,"tag":1021,"props":5503,"children":5504},{"style":1057},[5505],{"type":998,"value":1231},{"type":993,"tag":1021,"props":5507,"children":5508},{"style":1048},[5509],{"type":998,"value":1162},{"type":993,"tag":1021,"props":5511,"children":5512},{"class":1023,"line":91},[5513],{"type":993,"tag":1021,"props":5514,"children":5515},{"emptyLinePlaceholder":13},[5516],{"type":998,"value":1170},{"type":993,"tag":1021,"props":5518,"children":5519},{"class":1023,"line":100},[5520,5524,5528],{"type":993,"tag":1021,"props":5521,"children":5522},{"style":1027},[5523],{"type":998,"value":5434},{"type":993,"tag":1021,"props":5525,"children":5526},{"style":1036},[5527],{"type":998,"value":5390},{"type":993,"tag":1021,"props":5529,"children":5530},{"style":1027},[5531],{"type":998,"value":5532},": Test with a few more numbers\n",{"type":993,"tag":1021,"props":5534,"children":5535},{"class":1023,"line":109},[5536,5540,5544,5548,5553,5557,5561,5565,5569,5573,5577],{"type":993,"tag":1021,"props":5537,"children":5538},{"style":1089},[5539],{"type":998,"value":1186},{"type":993,"tag":1021,"props":5541,"children":5542},{"style":1048},[5543],{"type":998,"value":1191},{"type":993,"tag":1021,"props":5545,"children":5546},{"style":1036},[5547],{"type":998,"value":1196},{"type":993,"tag":1021,"props":5549,"children":5550},{"style":1057},[5551],{"type":998,"value":5552},"\"Factorial of 0: ",{"type":993,"tag":1021,"props":5554,"children":5555},{"style":1089},[5556],{"type":998,"value":1206},{"type":993,"tag":1021,"props":5558,"children":5559},{"style":1048},[5560],{"type":998,"value":1211},{"type":993,"tag":1021,"props":5562,"children":5563},{"style":1089},[5564],{"type":998,"value":1328},{"type":993,"tag":1021,"props":5566,"children":5567},{"style":1048},[5568],{"type":998,"value":1221},{"type":993,"tag":1021,"props":5570,"children":5571},{"style":1089},[5572],{"type":998,"value":1226},{"type":993,"tag":1021,"props":5574,"children":5575},{"style":1057},[5576],{"type":998,"value":1231},{"type":993,"tag":1021,"props":5578,"children":5579},{"style":1048},[5580],{"type":998,"value":1162},{"type":993,"tag":1021,"props":5582,"children":5583},{"class":1023,"line":118},[5584,5588,5592,5596,5601,5605,5609,5613,5617,5621,5625],{"type":993,"tag":1021,"props":5585,"children":5586},{"style":1089},[5587],{"type":998,"value":1186},{"type":993,"tag":1021,"props":5589,"children":5590},{"style":1048},[5591],{"type":998,"value":1191},{"type":993,"tag":1021,"props":5593,"children":5594},{"style":1036},[5595],{"type":998,"value":1196},{"type":993,"tag":1021,"props":5597,"children":5598},{"style":1057},[5599],{"type":998,"value":5600},"\"Factorial of 3: ",{"type":993,"tag":1021,"props":5602,"children":5603},{"style":1089},[5604],{"type":998,"value":1206},{"type":993,"tag":1021,"props":5606,"children":5607},{"style":1048},[5608],{"type":998,"value":1211},{"type":993,"tag":1021,"props":5610,"children":5611},{"style":1089},[5612],{"type":998,"value":1274},{"type":993,"tag":1021,"props":5614,"children":5615},{"style":1048},[5616],{"type":998,"value":1221},{"type":993,"tag":1021,"props":5618,"children":5619},{"style":1089},[5620],{"type":998,"value":1226},{"type":993,"tag":1021,"props":5622,"children":5623},{"style":1057},[5624],{"type":998,"value":1231},{"type":993,"tag":1021,"props":5626,"children":5627},{"style":1048},[5628],{"type":998,"value":1162},{"type":993,"tag":1363,"props":5630,"children":5632},{"id":5631},"solution-and-explanation",[5633],{"type":998,"value":5634},"Solution and Explanation 💡",{"type":993,"tag":5636,"props":5637,"children":5638},"details",{},[5639,5647,5946,5954],{"type":993,"tag":5640,"props":5641,"children":5644},"summary",{"className":5642},[5643],"cursor-pointer",[5645],{"type":998,"value":5646},"Click to see the complete solution",{"type":993,"tag":1007,"props":5648,"children":5649},{},[5650],{"type":993,"tag":1011,"props":5651,"children":5653},{"className":1013,"code":5652,"language":6,"meta":8,"style":8},"def factorial(n):\n    # Base case: factorial of 0 is 1\n    if n == 0:\n        return 1\n    \n    # Recursive case: n * factorial of (n-1)\n    return n * factorial(n - 1)\n\n# Test your function\nresult = factorial(5)\nprint(f\"Factorial of 5 is: {result}\")\n\n# Test with a few more numbers\nprint(f\"Factorial of 0: {factorial(0)}\")\nprint(f\"Factorial of 3: {factorial(3)}\")\n",[5654],{"type":993,"tag":1017,"props":5655,"children":5656},{"__ignoreMap":8},[5657,5672,5680,5703,5714,5721,5729,5760,5767,5775,5798,5837,5844,5852,5899],{"type":993,"tag":1021,"props":5658,"children":5659},{"class":1023,"line":12},[5660,5664,5668],{"type":993,"tag":1021,"props":5661,"children":5662},{"style":1036},[5663],{"type":998,"value":1039},{"type":993,"tag":1021,"props":5665,"children":5666},{"style":1042},[5667],{"type":998,"value":1045},{"type":993,"tag":1021,"props":5669,"children":5670},{"style":1048},[5671],{"type":998,"value":1051},{"type":993,"tag":1021,"props":5673,"children":5674},{"class":1023,"line":27},[5675],{"type":993,"tag":1021,"props":5676,"children":5677},{"style":1027},[5678],{"type":998,"value":5679},"    # Base case: factorial of 0 is 1\n",{"type":993,"tag":1021,"props":5681,"children":5682},{"class":1023,"line":36},[5683,5687,5691,5695,5699],{"type":993,"tag":1021,"props":5684,"children":5685},{"style":1036},[5686],{"type":998,"value":1076},{"type":993,"tag":1021,"props":5688,"children":5689},{"style":1048},[5690],{"type":998,"value":1081},{"type":993,"tag":1021,"props":5692,"children":5693},{"style":1036},[5694],{"type":998,"value":1755},{"type":993,"tag":1021,"props":5696,"children":5697},{"style":1089},[5698],{"type":998,"value":1435},{"type":993,"tag":1021,"props":5700,"children":5701},{"style":1048},[5702],{"type":998,"value":1097},{"type":993,"tag":1021,"props":5704,"children":5705},{"class":1023,"line":45},[5706,5710],{"type":993,"tag":1021,"props":5707,"children":5708},{"style":1036},[5709],{"type":998,"value":1105},{"type":993,"tag":1021,"props":5711,"children":5712},{"style":1089},[5713],{"type":998,"value":1110},{"type":993,"tag":1021,"props":5715,"children":5716},{"class":1023,"line":54},[5717],{"type":993,"tag":1021,"props":5718,"children":5719},{"style":1048},[5720],{"type":998,"value":1118},{"type":993,"tag":1021,"props":5722,"children":5723},{"class":1023,"line":63},[5724],{"type":993,"tag":1021,"props":5725,"children":5726},{"style":1027},[5727],{"type":998,"value":5728},"    # Recursive case: n * factorial of (n-1)\n",{"type":993,"tag":1021,"props":5730,"children":5731},{"class":1023,"line":72},[5732,5736,5740,5744,5748,5752,5756],{"type":993,"tag":1021,"props":5733,"children":5734},{"style":1036},[5735],{"type":998,"value":1134},{"type":993,"tag":1021,"props":5737,"children":5738},{"style":1048},[5739],{"type":998,"value":1081},{"type":993,"tag":1021,"props":5741,"children":5742},{"style":1036},[5743],{"type":998,"value":1143},{"type":993,"tag":1021,"props":5745,"children":5746},{"style":1048},[5747],{"type":998,"value":1148},{"type":993,"tag":1021,"props":5749,"children":5750},{"style":1036},[5751],{"type":998,"value":1153},{"type":993,"tag":1021,"props":5753,"children":5754},{"style":1089},[5755],{"type":998,"value":1092},{"type":993,"tag":1021,"props":5757,"children":5758},{"style":1048},[5759],{"type":998,"value":1162},{"type":993,"tag":1021,"props":5761,"children":5762},{"class":1023,"line":81},[5763],{"type":993,"tag":1021,"props":5764,"children":5765},{"emptyLinePlaceholder":13},[5766],{"type":998,"value":1170},{"type":993,"tag":1021,"props":5768,"children":5769},{"class":1023,"line":91},[5770],{"type":993,"tag":1021,"props":5771,"children":5772},{"style":1027},[5773],{"type":998,"value":5774},"# Test your function\n",{"type":993,"tag":1021,"props":5776,"children":5777},{"class":1023,"line":100},[5778,5782,5786,5790,5794],{"type":993,"tag":1021,"props":5779,"children":5780},{"style":1048},[5781],{"type":998,"value":5451},{"type":993,"tag":1021,"props":5783,"children":5784},{"style":1036},[5785],{"type":998,"value":2200},{"type":993,"tag":1021,"props":5787,"children":5788},{"style":1048},[5789],{"type":998,"value":5460},{"type":993,"tag":1021,"props":5791,"children":5792},{"style":1089},[5793],{"type":998,"value":1216},{"type":993,"tag":1021,"props":5795,"children":5796},{"style":1048},[5797],{"type":998,"value":1162},{"type":993,"tag":1021,"props":5799,"children":5800},{"class":1023,"line":109},[5801,5805,5809,5813,5817,5821,5825,5829,5833],{"type":993,"tag":1021,"props":5802,"children":5803},{"style":1089},[5804],{"type":998,"value":1186},{"type":993,"tag":1021,"props":5806,"children":5807},{"style":1048},[5808],{"type":998,"value":1191},{"type":993,"tag":1021,"props":5810,"children":5811},{"style":1036},[5812],{"type":998,"value":1196},{"type":993,"tag":1021,"props":5814,"children":5815},{"style":1057},[5816],{"type":998,"value":5488},{"type":993,"tag":1021,"props":5818,"children":5819},{"style":1089},[5820],{"type":998,"value":1206},{"type":993,"tag":1021,"props":5822,"children":5823},{"style":1048},[5824],{"type":998,"value":5497},{"type":993,"tag":1021,"props":5826,"children":5827},{"style":1089},[5828],{"type":998,"value":1226},{"type":993,"tag":1021,"props":5830,"children":5831},{"style":1057},[5832],{"type":998,"value":1231},{"type":993,"tag":1021,"props":5834,"children":5835},{"style":1048},[5836],{"type":998,"value":1162},{"type":993,"tag":1021,"props":5838,"children":5839},{"class":1023,"line":118},[5840],{"type":993,"tag":1021,"props":5841,"children":5842},{"emptyLinePlaceholder":13},[5843],{"type":998,"value":1170},{"type":993,"tag":1021,"props":5845,"children":5846},{"class":1023,"line":127},[5847],{"type":993,"tag":1021,"props":5848,"children":5849},{"style":1027},[5850],{"type":998,"value":5851},"# Test with a few more numbers\n",{"type":993,"tag":1021,"props":5853,"children":5854},{"class":1023,"line":136},[5855,5859,5863,5867,5871,5875,5879,5883,5887,5891,5895],{"type":993,"tag":1021,"props":5856,"children":5857},{"style":1089},[5858],{"type":998,"value":1186},{"type":993,"tag":1021,"props":5860,"children":5861},{"style":1048},[5862],{"type":998,"value":1191},{"type":993,"tag":1021,"props":5864,"children":5865},{"style":1036},[5866],{"type":998,"value":1196},{"type":993,"tag":1021,"props":5868,"children":5869},{"style":1057},[5870],{"type":998,"value":5552},{"type":993,"tag":1021,"props":5872,"children":5873},{"style":1089},[5874],{"type":998,"value":1206},{"type":993,"tag":1021,"props":5876,"children":5877},{"style":1048},[5878],{"type":998,"value":1211},{"type":993,"tag":1021,"props":5880,"children":5881},{"style":1089},[5882],{"type":998,"value":1328},{"type":993,"tag":1021,"props":5884,"children":5885},{"style":1048},[5886],{"type":998,"value":1221},{"type":993,"tag":1021,"props":5888,"children":5889},{"style":1089},[5890],{"type":998,"value":1226},{"type":993,"tag":1021,"props":5892,"children":5893},{"style":1057},[5894],{"type":998,"value":1231},{"type":993,"tag":1021,"props":5896,"children":5897},{"style":1048},[5898],{"type":998,"value":1162},{"type":993,"tag":1021,"props":5900,"children":5901},{"class":1023,"line":146},[5902,5906,5910,5914,5918,5922,5926,5930,5934,5938,5942],{"type":993,"tag":1021,"props":5903,"children":5904},{"style":1089},[5905],{"type":998,"value":1186},{"type":993,"tag":1021,"props":5907,"children":5908},{"style":1048},[5909],{"type":998,"value":1191},{"type":993,"tag":1021,"props":5911,"children":5912},{"style":1036},[5913],{"type":998,"value":1196},{"type":993,"tag":1021,"props":5915,"children":5916},{"style":1057},[5917],{"type":998,"value":5600},{"type":993,"tag":1021,"props":5919,"children":5920},{"style":1089},[5921],{"type":998,"value":1206},{"type":993,"tag":1021,"props":5923,"children":5924},{"style":1048},[5925],{"type":998,"value":1211},{"type":993,"tag":1021,"props":5927,"children":5928},{"style":1089},[5929],{"type":998,"value":1274},{"type":993,"tag":1021,"props":5931,"children":5932},{"style":1048},[5933],{"type":998,"value":1221},{"type":993,"tag":1021,"props":5935,"children":5936},{"style":1089},[5937],{"type":998,"value":1226},{"type":993,"tag":1021,"props":5939,"children":5940},{"style":1057},[5941],{"type":998,"value":1231},{"type":993,"tag":1021,"props":5943,"children":5944},{"style":1048},[5945],{"type":998,"value":1162},{"type":993,"tag":1001,"props":5947,"children":5948},{},[5949],{"type":993,"tag":1593,"props":5950,"children":5951},{},[5952],{"type":998,"value":5953},"Key Learning Points:",{"type":993,"tag":5955,"props":5956,"children":5957},"ul",{},[5958,5971,5982,5993],{"type":993,"tag":5959,"props":5960,"children":5961},"li",{},[5962,5964,5969],{"type":998,"value":5963},"📌 ",{"type":993,"tag":1593,"props":5965,"children":5966},{},[5967],{"type":998,"value":5968},"Base case",{"type":998,"value":5970},": Every recursive function needs a stopping condition (factorial(0) = 1)",{"type":993,"tag":5959,"props":5972,"children":5973},{},[5974,5975,5980],{"type":998,"value":5963},{"type":993,"tag":1593,"props":5976,"children":5977},{},[5978],{"type":998,"value":5979},"Recursive case",{"type":998,"value":5981},": Function calls itself with a smaller problem (n * factorial(n-1))",{"type":993,"tag":5959,"props":5983,"children":5984},{},[5985,5986,5991],{"type":998,"value":5963},{"type":993,"tag":1593,"props":5987,"children":5988},{},[5989],{"type":998,"value":5990},"Problem reduction",{"type":998,"value":5992},": Each call reduces the problem size until reaching base case",{"type":993,"tag":5959,"props":5994,"children":5995},{},[5996,5997,6002],{"type":998,"value":5963},{"type":993,"tag":1593,"props":5998,"children":5999},{},[6000],{"type":998,"value":6001},"Mathematical definition",{"type":998,"value":6003},": Recursion matches mathematical definitions naturally",{"type":993,"tag":1001,"props":6005,"children":6006},{},[6007,6009,6015],{"type":998,"value":6008},"Learn more about ",{"type":993,"tag":6010,"props":6011,"children":6012},"a",{"href":671},[6013],{"type":998,"value":6014},"object programming",{"type":998,"value":6016}," to discover how to organize code using classes and objects for even more powerful programming patterns.",{"type":993,"tag":1351,"props":6018,"children":6020},{"id":6019},"test-your-knowledge",[6021],{"type":998,"value":6022},"Test Your Knowledge",{"type":993,"tag":1001,"props":6024,"children":6025},{},[6026],{"type":998,"value":6027},"Test what you've learned about function recursion:",{"type":993,"tag":6029,"props":6030,"children":6034},"redirect-button",{"icon":6031,"label":6032,"url":6033},"pi pi-send","Take Quiz","/tutorial-quiz/python/function-recursion",[],{"type":993,"tag":1351,"props":6036,"children":6038},{"id":6037},"whats-next",[6039],{"type":998,"value":6040},"What's Next?",{"type":993,"tag":1001,"props":6042,"children":6043},{},[6044],{"type":998,"value":6045},"Congratulations! You've mastered the fundamentals of Python functions, from basic definitions to advanced recursion. You're now ready to explore object-oriented programming, where you'll learn to organize code using classes and objects.",{"type":993,"tag":1001,"props":6047,"children":6048},{},[6049,6051,6055],{"type":998,"value":6050},"Ready to continue? Check out our lesson on ",{"type":993,"tag":6010,"props":6052,"children":6053},{"href":671},[6054],{"type":998,"value":672},{"type":998,"value":6056},".",{"type":993,"tag":6058,"props":6059,"children":6060},"style",{},[6061],{"type":998,"value":6062},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .app-dark-mode .shiki span {color: var(--shiki-app-dark-mode);background: var(--shiki-app-dark-mode-bg);font-style: var(--shiki-app-dark-mode-font-style);font-weight: var(--shiki-app-dark-mode-font-weight);text-decoration: var(--shiki-app-dark-mode-text-decoration);}html.app-dark-mode .shiki span {color: var(--shiki-app-dark-mode);background: var(--shiki-app-dark-mode-bg);font-style: var(--shiki-app-dark-mode-font-style);font-weight: var(--shiki-app-dark-mode-font-weight);text-decoration: var(--shiki-app-dark-mode-text-decoration);}",{"title":8,"searchDepth":36,"depth":36,"links":6064},[6065,6068,6072,6076,6079,6083,6087,6088],{"id":1353,"depth":27,"text":1356,"children":6066},[6067],{"id":1365,"depth":36,"text":1368},{"id":1642,"depth":27,"text":1645,"children":6069},[6070,6071],{"id":1653,"depth":36,"text":1656},{"id":1950,"depth":36,"text":1953},{"id":2400,"depth":27,"text":2403,"children":6073},[6074,6075],{"id":2411,"depth":36,"text":2414},{"id":2841,"depth":36,"text":2844},{"id":2852,"depth":27,"text":2855,"children":6077},[6078],{"id":2863,"depth":36,"text":2866},{"id":3426,"depth":27,"text":3429,"children":6080},[6081,6082],{"id":3437,"depth":36,"text":3440},{"id":4069,"depth":36,"text":4072},{"id":4787,"depth":27,"text":4790,"children":6084},[6085,6086],{"id":4849,"depth":36,"text":4852},{"id":5631,"depth":36,"text":5634},{"id":6019,"depth":27,"text":6022},{"id":6037,"depth":27,"text":6040},1782373746453]