'How to define a function without using .values() to get values from a dictionary
def getValues(myDict):
return list(myDict.items())[0][1] # <-- my code returns only 1 value, I need all values
courses = {'CPS141':60, 'CSS210':30, 'CPS161':20}
print(getValues(courses))
expected output: [60,30,20]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
