- 6

what is the output of this code?

x=3 num= 17 print(num%x)

6th Nov 2020, 4:59 AM
hania rasheed
hania rasheed - avatar
5 Answers
+ 7
You could have run this code and you will get the answer. Why are you posting unwanted questions in qna. theres an inbuilt ide for python in sololearn
6th Nov 2020, 5:01 AM
Steve Sajeev
Steve Sajeev - avatar
+ 7
2 because 17 divided by 3 is 5 with 2 left over and the modulo operator (%) returns the remainder. The best way to learn this is to practice writing codes that use it. [I trust this answer is sufficiently modified so as not to require deletion.]
6th Nov 2020, 9:15 AM
David Ashton
David Ashton - avatar
+ 4
hania rasheed Run it on code play ground thank you . Happy coding :)
6th Nov 2020, 5:01 AM
NavyaSri
NavyaSri - avatar
+ 1
You are right David Ashton
6th Nov 2020, 11:25 AM
Steve Sajeev
Steve Sajeev - avatar