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