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