Ранее я уже упоминал о другой фишке из ˍˍ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
🚨3️⃣3️⃣3️⃣3️⃣4️⃣4️⃣4️⃣4️⃣4️⃣
Dear Prospective students,
We would like to remind you that just 3 days left to submit the applications for the IUT's second entrance exams. Thus, do not miss out the opportunity! Hurry up to register and get ready to embark on this extraordinary academic journey with IUT!
📱Application platform
🖱
⏳Deadline: June 14 (Friday) by 5 PM
🎬Application process tutorial
🔔Those applicants who got already registered, are kindly asked to pay the application fee using your Payment ID (sent to your email) via 🏦 , 💸 , 💸 appsby June 17, 5 PM to be able to take the entrance exam.
For more detailed information:
📞71 289 99 99 (0400)
✈️@askinhabot
Best regards,
IUT Admissions Team
#IUT#Admissions2024#ApplicationDeadline
☄️🔠🔠🔠🔠🔠🔠🔠🔠🔠🔠🔠🔠🔠🔠🔠☄️
Attention all prospective students! Please kindly note that the deadline for the application submission for the second entrance exams of IUT is today, June 14, by 5 PM.
This is a last chance for those who want to register for the exam now or re-submit the application in case any mistakes are found after reviewing.
📱Application platform
🖱
Please, don't hesitate to reach out to us if you have any last-minute questions or need assistance with your application via:
📞71 289 99 99 (0400)
✈️@askinhabot
➖➖➖➖➖➖➖➖➖➖
🎬Application process tutorial
Best of luck on your application process and exams!
IUT Admission Team
#IUTAdmissions2024#ApplicationDeadline#ProspectiveStudents#GoodLuck
☄️🔠🔠🔠🔠🔠🔠🔠🔠🔠🔠🔠🔠🔠🔠🔠☄️
Attention all prospective students! Please kindly note that the deadline for the application submission for the second entrance exams of IUT is today, June 14, by 5 PM.
This is a last chance for those who want to register for the exam now or re-submit the application in case any mistakes are found after reviewing.
📱Application platform🖱
Please, don't hesitate to reach out to us if you have any last-minute questions or need assistance with your application via:
📞71 289 99 99 (0400)
✈️@askinhabot
➖➖➖➖➖➖➖➖➖➖
🎬Application process tutorial
Best of luck on your application process and exams!
IUT Admission Team
#IUTAdmissions2024#ApplicationDeadline#ProspectiveStudents#GoodLuck