-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfirst.py
More file actions
executable file
·86 lines (82 loc) · 1.82 KB
/
first.py
File metadata and controls
executable file
·86 lines (82 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import random
#This is my first python code
print ("Hello Wrold!")
a,b,c=1,2,3
x=y=z=2
q=float(20.4)
g="text"
h=random.randrange(1,100)
def ilkFunction():
print("ilk fonksiyon")
def ikinciFunc():
print("Random100 ",h)
print(type(g))
# if (x>2):
# print("x>2")
# else:
# print("x<=2")
ilkFunction()
ikinciFunc()
if ("ex" in g):
print("var")
if ("erx" not in g):
print("yok")
# print(g[1:3])
# print(g[:3])
j="Falan {1} \nfilan {0}"
# print(j.format(b,a).upper())
## string methods çalışılacak.
## https://www.w3schools.com/python/python_strings_methods.asp
ilkListe = ["1",2,3,"2"]
# print (ilkListe[0:2])
# print (ilkListe.count("2"))
# print(type(ilkListe))
if ("3" in ilkListe):
print("var")
else:
print("yok")
ilkListe[2]="4"
# print (ilkListe)
ilkListe.insert(1,"0")
ilkListe.append("5")
# print(ilkListe)
ikinciListe=["Adana","Istanbul","Ankara","B","Rize"]
ilkListe.extend(ikinciListe)
ilkListe.pop(1)
print(ilkListe)
# for x in ilkListe:
# print(x)
# [print(x) for x in ilkListe]
yeniListe = [x for x in ilkListe if isinstance(x, str) and "n" in x]
print(yeniListe)
# yeniListe = [x for x in ilkListe if type(x) is not int]
# print (len(yeniListe))
yeniListe.sort()
print(yeniListe)
thistuple = tuple(("apple", "banana", "cherry", "apple", "cherry"))
print(thistuple)
thisset = {"apple", "banana", "cherry"}
print(thisset)
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
print(thisdict)
# for x in thisdict:
# print(thisdict[x])
# for x, y in thisdict.items():
# print("key: ",x," value: ", y)
# for x in range(2, 6):
# print(x)
kup = lambda a,b : a**b
print (kup(2,3))
class teneke:
def __init__(self,ad,soyad):
self.ad = ad
self.soyad = soyad
def bilgileri(self):
print(self.ad,self.soyad)
t1 = teneke("adı","soyadı")
t1.bilgileri()
print(t1.ad)