0

Python Challenge Question.

What is the output of the code? x ={1:2,2:3,3:4,4:6} Print(x.get(2,0)%x.get(5,4)) Why is answer 3?

7th Sep 2020, 2:42 PM
Qamber Hasnain
Qamber Hasnain - avatar
2 Réponses
+ 6
x.get(2,0) => 3. take value from x with key 2. x.get(5,4) => 4. because key 5 dont exist in x, so 4 from 2nd argument return. 3%4 => 3mod4 => 3
7th Sep 2020, 2:45 PM
Rei
Rei - avatar
7th Sep 2020, 2:59 PM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar