From Python
print(25//10**2+1)
The answer is 1
25//10**2
is
25
divided by 10
is 2
where 2 squared
is
Isn't it 4
?
Why is 0
coming out? ㅜ<
I am Corin who started studying Python for the first time today. It's a basic question, so I'm a bit embarrassed to ask this question I'm posting here because I don't have any other questions.
python
This is because the **
operator has a higher priority than the //
operator.
Therefore, 25//10**2+1
is the same as 25//(10**2)+1
. 25 divided by 100 is zero, plus one, so the result is one.
© 2024 OneMinuteCode. All rights reserved.