Level 1 : What will be the output of the following code snippet?


numbers = (4, 7, 19, 2, 89, 45, 72, 22)
sorted_numbers = sorted(numbers)
odd_numbers = [x for x in sorted_numbers if x % 2 != 0]
print(odd_numbers)

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