0
x = {5:6, 7:7, 8:9, 7:11} print(x.get(10, 9)%x.get(1, 5))
Can anyone explain about this code friends?
1 Antwort
+ 5
Yes
x is a dictionary which have key value pair
So get method is used to get value based on key and it accept 2 value one is key and another is default value.
So if key doesn't exist in dictionary then default value will be return
So 10 doesn't exist in x so
x.get(10, 9) = 9
Same x.get(1, 5) = 5
So 9 % 5 = 4 which is a reminder value.