Level 1 : What is the output of the below Python program?


a,b,c,n = 0,1,0,10
c = a+b
n = n-2
while n>0:
    print(c, end=" ")
    a = b
     b = c
     c = a+b
     n = n-1

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