+ 2

print(6+5-4*3/2%1)

Explain the output of this question

10th Dec 2020, 2:50 PM
คгשเภ๔ кย๓คг
คгשเภ๔ кย๓คг - avatar
4 Answers
+ 2
P ̲E ̲M ̲D ̲A ̲S ̲ Parenthesis Exponentiation Multiplication Division Addition Subtraction ᎢᕼᏆᔑ Ꮖᔑ Ꭲᕼᗴ ᑭᖇᝪᑕᗴᔑᔑ Ꭹᝪᑌ ᖴᝪᏞᏞᝪᗯ Ꭲᝪ ᔑᝪᏞᐯᗴ Ꮖᑎ ᑭᎩᎢᕼᝪᑎ
12th Dec 2020, 10:17 AM
Sayyam Jain
Sayyam Jain - avatar
+ 11
look: 1. 4*3 = 12 print(6+5-12/2%1) 2. 12 / 2 = 6 print(6+5-6%1) 3. 6 % 1 = 0 print(6+5-0) 4. 6 + 5 = 11 print(11 - 0) 5. 11 - 0 = 11.0 output : 11.0
10th Dec 2020, 2:52 PM
Иван Чикyнов
Иван Чикyнов - avatar
+ 1
Python uses float division, so the result became a float at step 2 not at step 5: 12 / 2 = 6.0 (Python also has floor division: 12 // 2 = 6 12 // 5 = 2 # decimals ignored ) Additive operarions(+,-) on integers will result in an int. 4 + 5 = 9 11 - 0 = 11
11th Dec 2020, 12:10 AM
Kevin ★
0
Print(6+5+4*3/2%1)
20th Dec 2022, 9:20 AM
dipti sapkal
dipti sapkal - avatar