Level 5 : What is the purpose of the if statement in Python?

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