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