To determine the number of minifigs contained in the set from the Millennium Falcon Prep Exercise, we need to retrieve the inventory of the set and count the number of minifigs it contains.
Here is the Python code to accomplish this:
```python
import requests
# Fetch the inventory of the set
response = requests.get("https://rebrickable.com/api/v3/lego/sets/millennium-falcon-prep-exercise/inv/")
inventory = response.json()
# Retrieve the minifigs from the inventory and count them
minifigs_count = len([item for item in inventory['results'] if item['item_type'] == 'MINIFIG'])
# Display the result
print(f"The set from the Millennium Falcon Prep Exercise contains {minifigs_count} minifigs.")
```
Make sure to have the `requests` library installed (`pip install requests`) before running this code.
Note: Replace `'millennium-falcon-prep-exercise'` with the correct set code if it differs from the one provided.
Q13:
How many minifigs are contained in the set from the Millennium Falcon Prep Exercise? Save this as Q13 (as an integer).
Note that there are sometimes multiple versions of a set as shown in the inventories table. This will not matter for this question as there is only one version for the respective set but this should be noted for future questions.
Remember to show your work or your answer will manually get marked as incorrect.provide the python code
1 answer