Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wpforms-lite domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/ragipunal.com/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the businext domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/ragipunal.com/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the businext domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/ragipunal.com/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/ragipunal.com/wp-includes/functions.php on line 6114
Python Tamsayılar (Integers) - RAGIP ÜNAL

Blog

Python Tamsayılar (Integers)

Python’da tam sayılarda bölme işlemlerinin kolaylıkla yapılabildiğini göreceksiniz. Tamsayılar diyince aklımıza, ondalık nokta içermeyen yeni kesirsiz değerlerdir.

>>> 42+88
130

Bölme ve Tam Sayı Bölme:

Python’da bölme işlemi / sembolü ile gerçekleştirilir.

>>> 10/3
3.3333333333333335

% (yüzde) sembolü ise modüler işlemler için kullanılır. Yani kalan sayıyı verecektir.

>>> 10%3
1

divmod fonksiyonu ise iki tam sayının bölümündeki bölüm ve kalanı bulabilirsiniz.

>>> divmod(10,3)
(3, 1)

Tam Sayı Bölme

İki tam sayının bölümünden tam sayı olarak elde etmek istersek int fonksiyonunu kullanabiliriz.

>>> 6/4
1.5
>>> int(6/4)
1

Ya da // sembollerini kullanarak aynı sonucu elde etmek mümkündür.

>>> 6//4
1

Başka bir örnekler

>>> int(6.0/4)
1
>>> int(6/4.0)
1
>>> 6.0//4
1.0
>>> 6//4.0
1.0

Leave A Comment

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir