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