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