Ранее я уже упоминал о другой фишке из ˍˍfutureˍˍ , это оператор деления.
from __future__ import division
Суть проста. Раньше сложность типа данных результата поределялась типом самого сложного операнда.
Например:
int/int => int
int/float => float
В первом случае оба операнда int, значит и результат будет int. Во втором float более сложный тип, поэтому результат будет float.
Если нам требуется получить дробное значение при делении двух int то приходилось форсированно один из операндов конверировать в float.
12/float(5) => float
Но с новой "философией" это не требуется. В Python3 "floor division" заменили на "true division" а старый способ теперь работает через оператор "//".
>>> 3/2
1.5
>>> 3//2
1
То есть теперь деление int на int даёт float если результат не целое число.
В классах теперь доступны методы __floordiv__() и __truediv__() для определения поведения с этими операторами.
Данный переход описан в PEP238.
#pep#2to3#basic
We would like to share CEFR results from our MAIN branch, a.ka. home of real achievers 🥳🔥
Abrorbek Patiddinov B2/52
Nozimaxon Akbarova: B2/53
And Muhammadali Abdumalikov C1/65
Their teacher: Mr.Shermuhammad
🎉 Congratulations on their initial academic accomplishments!!! 🎉
And, we hope to see them get high results from IELTS, as well!
We also would like to extend our gratitude to their teacher, Mr. Shermuhammad, for his tireless efforts to produce such results week in and week out! 🤝
To join our courses, call 742281121
#studentssuccess
ADC - The Way To Knowledge
We would like to share CEFR results from our MAIN branch, a.ka. home of real achievers 🥳🔥
So, here we go!
Bexruz; B2/53 (L and R: 58)
Shoxjahon; B2/58 (L 64 and Sp 66)
Rahmonberdi; B2/54 (L 57 and Sp 56)
Diyora; B2/61 (L 73 🥳 R 67 🔥)
And Asliddin; C1/66 (L 70 and R 68)
🎉 Congratulations on their initial academic accomplishments!!! 🎉
And, we hope to see them get high results from IELTS, as well!
We also would like to extend our gratitude to their teacher, Mr. Shermuhammad, for his tireless efforts to produce such results week in and week out! 🤝
To join our courses, call 742281121
#studentssuccess
ADC - The Way To Knowledge
YANA BIR BAND 7️⃣.0️⃣👑
🤜BAND 7.0🤜
LISTENING: 7.0 🚀
READING: 7.5 🤓
WRITING: 6.5✍️
SPEAKING: 7.0 🔥
Full Name: Charos Rustamova👑
Attempt: 1st ✨
With British Council
Age: 16 🤯
Teacher: Mr. Shermuhammad (8.5)
General English, working hard and choosing the right teacher are the key elements to success in IELTS🍸
#ieltsresult#studentssuccess#band70#mainoffice
THINK IELTS, THINK ADC