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