Level 3 : what is the output of the following code?


def list_within_list():
    alist = [3, 67, "cat", [56, 57, "dog"], [ ], 3.14, False]
    return alist[2][0]

Author: Devakanth | Tags: list | 1859+ Python FAQs | Share
unit-testing | string-slicing | sum() | software-design | string | string-iteration | static-method | recursion | set-operation | dicts | function-and-scope | string-slicing | class-and-instance-variable | __all__-attribute | sets | syntax-error | indentation | scientific-notation | split | key-value-pairs | sorting-and-ranking | strings | shallow-copy | else-statement | append | assignment-operator | sys | single-inheritance | lambda | reading:-read(),-readline(),-readlines() | array | staticmethod | identity-operator | booleans | __future__ | for | access-modifier | sorting | iterators | bitwise | round-function | attribute | swapping | introduction-to-threads | collection | list-comprehension | functional-programming | file_handling | input | sys-module | identity-operators-(is,-is-not) | sorted | classes | function | filter | regular-expressions | conditional-statements | generators-in-python | iterator | conditional-statement | class-and-object | docstring | lambda-function | global-variable | tuple-unpacking | working-with-temporary-files-using-tempfile | keyword | set | dictionary-methods | time-series-with-pandas | handling-missing-values-(fillna,-dropna) | generators | regex | functions | collections | head-and-tail | built-in-function | using-os-and-pathlib-modules | version | loop-control | threading | data-structures-in-python | global | zip | yield | library | immutability | bitwise-operator | thread-safe-data-structures-(queue.queue) | python-django | string-methods | syntax-error | slicing | data-structure | introduction-to-multiprocessing | using-the-threading-module | init | list-operation | slice | version-check | logical-operator | oop | sum-function | built-in-modules | multithreading | binary | matplotlib | multiprocessing | python-history | built-in-function | functional-programming | int | thread-synchronization | magic-method | integer | quantifiers-(*,-+,-?,-{}) | typeerror | logical-operation | update | string-manipulation | numeric | list-comprehensions | raise | decimal | list-methods-and-slicing | tuple | installation | polymorphism | datetime | operator-or | identifier | reading-and-writing-files | command-line-parsing | touples | complex | random | managing-directories-with-os-and-shutil | iterable | python-repl | rollback | comparison | matrix-list-comprehension | logical-operators | arbitrary-arguments-(*args,-**kwargs) | integers | string-formatting | zip-function | arithmetic-expression | call | constructor | factorial-function | bitwise-operator | inherit | destructor | python-module | fabs-function | turtle | tuple-methods | return-statement | floating-point-precision | decorator | why-use-multiprocessing-over-threading?-(gil) | filter-function | inheritance | joining-and-merging-dataframes | error-handling | defining-functions | expand-tab | max-min | heap-memory | complex-number | arithmetic-operation | type-conversion | dictionary-comprehensions | mathematical-function | pass | __init_subclass__ | min-function | comprehension | using-map()-for-transformations | precedence-and-associativity | introduction-to-python | dictionary | identity-operator | using-lists-as-stacks | thread | type-conversion | input-function | exception-handling | floats | dictionaries | list-indexing | loop-control-statements | expression | overflow | multiple-inheritance | implementation | name-mangling | join | class | python | tuples | generator | pep | intering | list-join | directory-operations | datatype | list-mutation | namespace | descriptors | error | string-concatenation | range | type-conversion-and-casting | immutable-data-type | working-with-file-paths | pseudocode | logical-operator | list-method | walking-through-directories-using-os.walk() | escape-operator | while-loops | type_conversion | exception | operators | frozenset | design-principle | recurssion | string-method | basic | using-assertions-(assertequal,-assertraises) | comment | lambda-functions | asyncio-module | string-formatting | data-type-conversions | with-statement | difference-between-threads-and-processes | python-syntax-and-structure | operator-and | default-mutable-argument | matrix | variable | list-vs-tuple | asyncio | enumerate() | indexing | format | assert | invalid-list | using-join()-and-is_alive()-methods | writing:-write(),-writelines() | interpreter | virtual-environment | opening-files-(open()) | id-function | syntax | class-and-inheritance | working-with-dates-and-times | list | exponentiation | mutable | async | while-else-loop | string-method | pickling--unpickling | mapping-function | input-function | memory | math | center | indexing:-loc-vs-iloc | higher-order-function | while-and-for-loop | map-function | module | object-attribute | nested-loop | reading-and-writing-large-files-efficiently | lambdas | operator | list-slicing | regular-expression | function-argument | overriding-methods | multiple-except-blocks | package-management | loops | using-else-and-finally | encapsulation | exception-handling | literal-characters-and-special-characters | method-overloading | oops | error-handling | creating-and-starting-threads | file | goto-function | debugging | test-discovery | class-decorators | formal-and-actual-parameter | file-handling | else | working-with-binary-files-(rb,-wb) | conversion | objects | counter-function | context-manager | filtering-and-indexing | anchors-(^,-$) | random-function | operations | global-variable | boolean-and-non-boolean | memory-management | control-flow | min-max-function | python-operators | compute | creating-custom-modules | print-statement | multiple-inheritance | operator-overloading | encoding | lists | numpy | assignment-operators | file-handling | mathematics | global-keyword | advanced-file-operations | list-comprehension | conditional-statement | postfix | feature | precedence | formatting-with-strftime | gil | pandas | aggregating-data-with-functools.reduce() | import-method | boolean | condition | print | parameter | mysql | control-flow | benefit | data-type | operand | round | raise-statement | using-yield-in-functions | application | built-in | list,-set,-and-dictionary-comprehensions | python_version | parsing-with-strptime | control-statement | loop | method | choice | match | odd-number | data-structures | data-type | counter | copy | binary-operation | datetime.date,-datetime.time,-datetime.datetime | boolean-masking | syntaxerror | data-types | data-structure | methods | deep-copy | math-copysign | virtual-environment | stack | namedtuple | default-arguments | zfill-function | data_structure | dataframe-and-series-objects | statement | membership-operators-(in,-not-in) | def | while-loop ...