PCEP-30-02試験無料問題集「Python Institute PCEP - Certified Entry-Level Python Programmer 認定」
Assuming that the phonc_dir dictionary contains namemumber pairs, arrange the code boxes to create a valid line of code which retrieves Martin Eden's phone number, and assigns it to the number variable.


正解:

Explanation:

number = phone_dir["Martin Eden"]
This code uses the square brackets notation to access the value associated with the key "Martin Eden" in the phone_dir dictionary. The value is then assigned to the variable number. A dictionary is a data structure that stores key-value pairs, where each key is unique and can be used to retrieve its corresponding value. You can find more information about dictionaries in Python in the following references:
* [Python Dictionaries - W3Schools]
* [Python Dictionary (With Examples) - Programiz]
* [5.5. Dictionaries - How to Think Like a Computer Scientist ...]
Insert the code boxes in the correct positions in order to build a line of code which asks the user for an integer value and assigns it to the depth variable.
(Note: some code boxes will not be used.)

(Note: some code boxes will not be used.)

正解:

Explanation:

One possible way to insert the code boxes in the correct positions in order to build a line of code which asks the user for an integer value and assigns it to the depth variable is:
depth = int(input("Enter the immersion depth: "))
This line of code uses the input function to prompt the user for a string value, and then uses the int function to convert that string value into an integer number. The result is then assigned to the variable depth.
You can find more information about the input and int functions in Python in the following references:
* [Python input() Function]
* [Python int() Function]

