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