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