0% found this document useful (0 votes)
6 views4 pages

Python 2

Uploaded by

aslihantt5
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views4 pages

Python 2

Uploaded by

aslihantt5
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python 2

October 7, 2025

[1]: # Float veri tipi (Ondalık sayı)

pi=3.14
yaricap=6
alan=pi * yaricap**2
print(alan)

113.04

[2]: # Her bölme işleminin sonucu float veri tipindedir.

print(4/2)

2.0

[3]: # Boolean veri tipi (True, False)

a=True
print(not a)

False

[4]: # Boolean veri tipleriyle matematiksel işlemler yaparsak True=1, False=0 olarak␣
↪alırız.

print(a + (not False))

[5]: print(True * False)

[6]: p=True
q=False
print(p and q)
print(p or q)
print(p and not q)
print(not p or q)

1
False
True
True
False

[7]: a="3.6"
b=8
c=True
d=4.7
print(type(a), type(b), type(c), type(d))

<class 'str'> <class 'int'> <class 'bool'> <class 'float'>

[8]: # Veri tipi dönüşümleri

# int() fonksiyonu aldığı değeri integer'a dönüştürür.

int(3.6)

[8]: 3

[9]: int("45") * 2

[9]: 90

[10]: a="3"
print(a*5)

33333

[11]: int(a) * 5

[11]: 15

[12]: # str() fonksiyonu aldığı değeri string'e dönüştürür.

str(3) * 5

[12]: '33333'

[13]: str(True) * 3

[13]: 'TrueTrueTrue'

[14]: # float() fonksiyonu aldığı değeri float'a dönüştürür.

float("3.8") + 1

[14]: 4.8

2
[15]: float(56)

[15]: 56.0

[18]: # bool() fonksiyonu aldığı değeri boolean'a dönüştürür.

print(bool("abc"))
print(bool(""))
print(bool(324))
print(bool(0))

True
False
True
False

[19]: bool(" ")

[19]: True

[20]: bool(0.0)

[20]: False

[21]: bool(0.1)

[21]: True

[22]: bool(-90)

[22]: True

[25]: bool("False")

[25]: True

[26]: bool(int("0"))

[26]: False

[33]: # round() fonksiyonu sayıları yuvarlar.

t=93.368
print(round(t))
print(round(t, 0))
print(round(t, 1))
print(round(t, 2))

3
93
93.0
93.4
93.37

[29]: round(67.8)

[29]: 68

[ ]:

You might also like