Level 3 : What will be the output of the following Python code?


i = 1
while True:
    if i%3 == 0:
        break
    print(i)
 
    i + = 1

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