Level 1 : What will be the output of the following code?


a=0
while a<6:
    print(a)
    if a==4:
       break
else:
  print(0)

Author: SarojiniD | Tags: loop | 1736+ Python FAQs | Share
assignment-operator | list-operation | virtual-environment | comprehension | dictionaries | generators | name-mangling | application | built-in-function | operator-overloading | data-structure | arithmetic-operation | indexing | python-django | exception | complex | higher-order-function | list | data_structure | center | static-method | precedence | destructor | basic | dicts | bitwise-operator | logical-operator | regex | list-comprehension | type_conversion | sys-module | set | filter | heap-memory | input-function | type-conversion | syntaxerror | inherit | data-type | def | asyncio-module | generator | shallow-copy | lambdas | precedence-and-associativity | binary-operation | exception-handling | string-method | pep | lambda-function | postfix | binary | variable | virtual-environment | mathematics | python-module | choice | keyword | decimal | complex-number | version | syntax-error | assert | turtle | map-function | typeerror | mysql | counter | design-principle | boolean-and-non-boolean | memory | arithmetic-expression | gil | formal-and-actual-parameter | lists | built-in-function | syntax | function | recurssion | statement | lambda | counter-function | conditional-statement | identity-operator | object-attribute | identity-operator | string-iteration | type-conversion | loops | data-type | software-design | function-argument | error | feature | string-formatting | __init_subclass__ | input-function | touples | conversion | syntax-error | asyncio | global-variable | iterable | list-join | constructor | math | encoding | sum() | yield | list-method | slicing | polymorphism | tuple | tuple-unpacking | version-check | append | memory-management | logical-operation | generators-in-python | sorting | operator-and | namedtuple | condition | oop | swapping | comment | global | package-management | while-loop | init | multithreading | global-variable | implementation | return-statement | threading | random-function | thread | operator | random | methods | file | matrix | min-max-function | print-statement | min-function | list-slicing | class | operand | docstring | collections | max-min | pandas | iterator | class-and-object | overflow | format | copy | list-indexing | zfill-function | operations | loop | zip | recursion | mapping-function | matrix-list-comprehension | control-statement | pseudocode | python-history | file-handling | list-vs-tuple | expression | bitwise-operator | range | async | match | multiprocessing | module | context-manager | regular-expression | interpreter | with-statement | set-operation | fabs-function | oops | classes | identifier | string-method | data-structures | class-and-inheritance | pickling-&-unpickling | string | zip-function | rollback | list-comprehension | python_version | functional-programming | python-repl | file-handling | input | sorted | update | split | while-and-for-loop | logical-operator | file_handling | installation | boolean | control-flow | import-method | string-slicing | nested-loop | exponentiation | mutable | array | method | head-and-tail | default-mutable-argument | __all__-attribute | enumerate() | string-slicing | factorial-function | class-and-instance-variable | python | round-function | benefit | call | while-else-loop | magic-method | numpy | error-handling | math-copysign | dictionary | staticmethod | descriptors | conditional-statement | escape-operator | indentation | immutable-data-type | debugging | join | goto-function | sum-function | attribute | namespace | inheritance | decorator | operator-or | print | raise | access-modifier | datatype | exception-handling | expand-tab | bitwise | global-keyword | data-structure | control-flow | immutability | string-manipulation | int | frozenset | parameter | multiple-inheritance | compute | for | __future__ | string-formatting | built-in | deep-copy | matplotlib | library | invalid-list | round | command-line-parsing | loop-control | stack | operators | function-and-scope | comparison | odd-number | collection | id-function | slice | list-mutation | functions | integer | datetime | objects | else-statement | string-concatenation | numeric | encapsulation | sys | mathematical-function | filter-function | scientific-notation | floating-point-precision ...