-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnot_stringmethododev.py
More file actions
68 lines (47 loc) · 2.03 KB
/
Copy pathnot_stringmethododev.py
File metadata and controls
68 lines (47 loc) · 2.03 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
website = "http://www.sadikturan.com"
course = "Python Kursu: Baştan Sona Python Programlama Rehberiniz (40 saat)"
# 1-' Hello World ' karakterinin dizisinin baş ve sondaki boşluk karakterlerini silin.
result=" Hello World u".strip()
result=" Hello World u".lstrip()
result=" Hello World u".rstrip()
result = website.lstrip('/:pth')
# 2- "www.sadikturan.com" içindeki sadikturan bilgisi haricindeki her karakterii silin.
result = "www.sadikturan.com".lstrip('w.').rstrip('.com')
# veya
result = "www.sadikturan.com".strip('w..com')
# 3- 'course' karakter dizisinin tüm karakterlerini küçük harf yapın.
result = course.lower()
# 4- 'website' içinde kaç tane a karakteri vardır?(count('a'))
result = website.count('a')
result = website.count('www')
result = website.count('www',0,10)
# 5- 'website www ile başlayıp com ile bitiyor mu? )'
result = website.startswith('www')
result = website.endswith('com')
# 6- 'website' içinde '.com' ifadesi var mı ?
result = website.find('.com')
result = website.find('.com',0,15)
result = course.find('Python')
result = course.rfind('Python')
result =website.index('com')
result =website.rindex('com')
# result =website.index('comm') # exception
# 7- ' course içindeki karakterlerin hepsi alfebetik mi? (isalpha, isdigit)'
result = course.isalpha()
result = 'hello'.isalpha()
result = course.isdigit()
result = '1235'.isdigit()
# 8- 'content' ifadesini satırda 50 karakter içine yerleştirip sağ ve soluna * ekleyiniz.
result = "content".center(50,"*")
result = "content".ljust(50,'*')
result = "content".rjust(50,"*")
# 9- course karakter dizisindeki tüm boşluk karakterlerini '-' ile değiştirin.
result = course.replace(" ", "-")
result = course.replace(" ", "-",5)
result = course.replace(" ", "")
# 10- "hello world" karakter dizisinin 'World ifadesini 'there' olaraka değiştirin'
result = "hello world".replace("world","there")
# 11- 'course' karakter dizisini boşluk karakterlerinden ayırın.
result = course.split(' ')
result = result[5]
print (result)