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