asked 74.3k views
0 votes
12.3 queston 1 projet stem please help

Write a method named print_capitals which prints every value from a dictionary parameter in capital letters. So, for example, this call
d = {"green": "go", "yellow": "prepare", "red": "stop"}
print_capitals(d)
should print the following:
GO
PREPARE
STOP


1 Answer

4 votes

Answer:

python

def print_capitals(d: dict):

for key in d:

print(d[key].upper())

# Example usage:

d = {"green": "go", "yellow": "prepare", "red": "stop"}

print_capitals(d)

```

answered
User Inspectah
by
8.1k points