Level 1 : Output of this snippet?


lst = [1, 2, 3, 4]
print(lst.index(5) if 5 in lst else -1)

Author: SandhyaR | Tags: list | 1736+ Python FAQs | Share
exponentiation | mathematics | package-management | typeerror | implementation | pickling-&-unpickling | python-history | set-operation | matrix | round-function | generator | design-principle | min-function | command-line-parsing | name-mangling | function | compute | list-method | list-comprehension | expand-tab | keyword | data-structure | for | bitwise-operator | method | sys | list-operation | class | encoding | destructor | bitwise-operator | loop-control | deep-copy | function-and-scope | map-function | access-modifier | sum-function | __init_subclass__ | input | slicing | data-type | function-argument | objects | assert | floating-point-precision | choice | error | namespace | list-vs-tuple | multithreading | built-in-function | class-and-instance-variable | print | type-conversion | yield | exception | conditional-statement | file | matrix-list-comprehension | string-manipulation | integer | format | else-statement | attribute | magic-method | tuple | list-indexing | math | exception-handling | python-repl | frozenset | head-and-tail | precedence | range | overflow | fabs-function | data-type | stack | mathematical-function | class-and-object | datatype | file-handling | copy | expression | round | tuple-unpacking | global-keyword | operator-or | postfix | complex-number | call | operator-and | sum() | built-in | async | data-structures | class-and-inheritance | feature | statement | datetime | staticmethod | touples | zip | raise | syntax | methods | inheritance | join | random-function | lists | installation | lambda-function | oops | odd-number | file_handling | operations | operator-overloading | assignment-operator | operand | gil | data-structure | escape-operator | swapping | oop | lambda | mutable | collections | multiprocessing | heap-memory | id-function | indexing | context-manager | encapsulation | memory-management | goto-function | return-statement | interpreter | math-copysign | condition | thread | nested-loop | formal-and-actual-parameter | error-handling | factorial-function | recurssion | file-handling | max-min | data_structure | built-in-function | invalid-list | def | boolean | binary | sys-module | exception-handling | immutable-data-type | basic | pseudocode | control-statement | dictionary | global-variable | logical-operation | int | mapping-function | import-method | mysql | array | string-concatenation | variable | python_version | inherit | __all__-attribute | constructor | update | random | application | version-check | identifier | type_conversion | immutability | conditional-statement | list | global | turtle | type-conversion | python-module | string-method | asyncio-module | functional-programming | python | indentation | loops | set | virtual-environment | comment | identity-operator | list-slicing | split | pandas | control-flow | min-max-function | namedtuple | memory | shallow-copy | while-else-loop | arithmetic-expression | string-iteration | regex | global-variable | iterable | string-formatting | lambdas | asyncio | parameter | slice | zip-function | virtual-environment | comparison | descriptors | decimal | decorator | center | numpy | list-join | dictionaries | generators-in-python | string | input-function | operator | print-statement | enumerate() | regular-expression | counter-function | syntaxerror | default-mutable-argument | matplotlib | syntax-error | list-mutation | module | collection | __future__ | precedence-and-associativity | iterator | string-formatting | pep | string-slicing | software-design | static-method | generators | init | debugging | filter-function | string-method | append | bitwise | library | comprehension | loop | operators | benefit | logical-operator | version | conversion | object-attribute | higher-order-function | threading | string-slicing | while-loop | filter | boolean-and-non-boolean | numeric | while-and-for-loop | match | syntax-error | zfill-function | counter | complex | logical-operator | input-function | python-django | rollback | control-flow | polymorphism | dicts | list-comprehension | arithmetic-operation | binary-operation | identity-operator | classes | multiple-inheritance | scientific-notation | docstring | functions | with-statement | sorted | sorting | recursion ...