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