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


a = ~4
b = a + 4
print (b)

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