-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDemo_String.py
More file actions
57 lines (47 loc) · 1.3 KB
/
Demo_String.py
File metadata and controls
57 lines (47 loc) · 1.3 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
website = "http://www.yektaduran.com"
course = "Python Kursu: Baştan Sona Python Programlama Rehberiniz (40 saat)"
# 1- 'course' karakter dizisinde kaç karakter var?
# x = len(course)
# print(x)
# 2- 'website' içinden www karekterini al
# x = website[7:10]
# print(x)
# 3- 'website' içinden com karekterini al
# x = website[-3:]
# print(x)
# 4- 'course' içinden ilk 15 ve son 15 karakterlerini al
# x = course[:15] +' '+ course[-15:]
# print(x)
# 5- 'course' ifadesini tersten yazdır
# x = course[:]
# w = course[::-1]
# #print(x)
# print(w)
# name, surname, age, job = 'Yekta', 'Duran', 40, 'Mühendis'
# # 6- Yukarıda verilen değişkenler ile ekrana:
# # 'Benim adım Yekta Duran, yaşım 40 ve mesleğim Mühendis'
# #print(f"Benim adım {name} {surname}, yaşım {age} ve mesleğim {job}")
# print(f"Benim adım {name} {surname}, \nyaşım {age} ve \nmesleğim {job}")
# 7- 'Hello world' ifadesinde 'w' harfini 'W' ile değiştir
x = "Hello world"
# x = x[:6]+'W'+ x[7:]
# print(x)
# x = x.replace('w','W')
# print(x)
y = "Hello World"
# y = y.replace('W','w')
# print(y)
# y= y[:6]+ 'w' + y[7:]
# print(y)
# y = y[:6] + y[6:].upper()
# print(y)
# 8- 'abc' ifadesinde 3 kere yanyana yazdır
x = "abc"
# x = x*3
# print(x)
# x = (x+"\n")*3
# print(x)
# x = (x+" ")*3
# print(x)
x = (x+("\n"*4))*3
print(x)