- 18
What is the output of this code? >>> x = 3 >>> num = 17 >>> print(num % x)
44 Antworten
+ 43
2, because if you divide 17 by 3 the remainder will be 2 and this sign % counts the remainder
+ 8
I don't know how the program works in detail (is that your question?) but there are few possibilities to see what % does.
As example with your code
1.1) _ _
17:3=5,6 0,6×3=2
1.2) _
17:3=5,6 round down->5×3=15 -> 17-15=2
2)
17:3=5
-15
-----
2
I hope it's helpful 😅
+ 5
The answer is 2
This is because the % operator returns the remainder of the two numbers it is dividing.
in your code you are asking what the remainder is when you divide 17 by 3
3 can go into 17 five times, which would make 15. Then the operator takes 17 and 15 and finds the difference between the two, 17-15 = 2
+ 4
well, thats because this sign % returns the remainder, thats its function, and the print function is used to print out a value to the screen.. How else can she explain more? what details do you want to know?
+ 3
it will 2 according to math
+ 2
The answer is 2 because % is mod operator which returns remainder. 3*5=15 and remainder is 2.
+ 1
% is the modulus operator which returns remainder.
so when 17 is divided by 3 remainder is 2.
+ 1
2
+ 1
The answer is 2 for the record
+ 1
2
+ 1
2
0
i know its 2 but tell me how
0
2
0
sorry, the output is 2, because 3*5= 15, 17-15 = 2
if your num is 18, the output will be 0 because 3*6 = 18, 18-18 = 0
0
% the modulus, returns the reminder,. so ans is obviously 2
0
2 the answer
0
its simple % this sign is called modulus it is used to obtain the remainder 17%3 means you want to know the remainder when 17 is divided by 3 well the closest whole number where 3 is giving is 15 and 17-15=2 that's how it is giving 2
0
x = 3, num = 17
Here you are giving 17 as num, which is not exactly divisible by 2
Well finally you want to print the reminder
So, 17/3 = 15 and 17-15 = 2
Hence 2 is the output/reminder
0
2
0
it is 2
it is easy
17%3 = 2 which is the remainder of the division process