Level 1 : What does the following expression return?


d = {'a': 1, 'b': 2}
print(d.fromkeys(['x', 'y'], 10))

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