Level 1 : What type of result that returns the below code, if the input 1s 23?


num = int(input("enter a number: "))

flag = False
if num > 1:
    for i in range(2, num):
        if (num % i) == 0:
            flag = True
            break
if flag:
    print(num)
else:
    print(num)

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