Mooduli math meetod modf
Mooduli math meetod modf
tagastab antud arvu murd- ja
täisosast koosneva korteeži.
Süntaks
import math
math.modf(arv)
Näide
Uurime arvu 20 murd- ja täisosa:
import math
print(math.modf(20))
Koodi täitmise tulemus:
(0.0, 20.0)
Näide
Rakendame nüüd meetodit modf arvule
20.56:
import math
print(math.modf(20.56))
Koodi täitmise tulemus:
(0.5599999999999987, 20.0)