Ранее я уже упоминал о другой фишке из ˍˍ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
#FactFriday
Feeling better doesn’t mean the infection is gone.
Stopping antibiotics without proper guidance can fuel Antimicrobial Resistance (AMR) making infections harder to treat.
✔️Always follow your healthcare provider’s advice.
✔️ Only use antibiotics when prescribed
✔️ Always complete your dose
✔️ Take antibiotics exactly as prescribed
✔️ Don’t stop, skip, or share medications.
✅Your actions today protect your health tomorrow.!
#FactFriday#StopAMR#PublicHealth#NCDCNigeria
💊 Misuse of Antibiotics makes them dangerous.
💯Protect your health and help fight Antimicrobial Resistance (AMR) by avoiding self-diagnosis. Always consult a qualified healthcare professional and get a prescription before taking antibiotics✅️
Together we can Fight Antimicrobial Resistance (AMR)and protect the effectiveness of antibiotics for ourselves and future generations.💪
Use antibiotics responsibly, save lives!!
#StopAMR#GlobalHealth#NCDCNigeria
#Antimicrobial Resistance (AMR) is a global threat.
✨As a healthcare professional, always carry out the correct test before prescribing.
Accurate diagnosis helps prevent resistance☑️
Always test before treating!!
#StopAMR#StaySafe#NCDCNigeria
#Antimicrobial Resistance (AMR) is a growing global health threat — but together, we can prevent it! 🚫💊
👉 Don’t self-medicate
👉 Complete your prescriptions
👉 Don’t share leftover drugs
👉 wash hands frequently with soap under running water
👉 Stay protected with vaccines
Let’s all take responsibility in the fight against AMR. 💪🌍
#StopAMR#StaySafe#NCDCNigeria
Antibiotics are lifesavers when used correctly but misuse can make infections harder to treat. 🦠💊
#AntimicrobialResistance (AMR) is a growing public health threat caused by self-medication, incomplete doses, and improper antibiotic use. Protect yourself and others by using antibiotics only as prescribed.
✅ Complete your medications
✅ Avoid self-medication
✅ Practice good hygiene
✅ Seek medical care when symptoms persist
Together, we can fight AMR and keep treatments effective for the future.
#StopAMR#HealthAwareness#NCDCNigeria#StaySafe