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