-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstrings.py
More file actions
49 lines (45 loc) · 860 Bytes
/
Copy pathstrings.py
File metadata and controls
49 lines (45 loc) · 860 Bytes
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
#creating string
# print('Hello World')
# print("Hello Python")
# print("""I am asif""")
# print("I am 24 year's old")
# print('I am " Asif')
# print("""Hello
# My name is
# Asif""")
# print(str(23))
# li = str([12,3,2])
# print(li,type(li))
#accessing the string - indexing/slicing
s1 = "Hello Bangladesh"
# print(s1[0])
# print(s1[4])
# print(s1[-2])
# print(s1[len(s1)-5])
# print(s1[::])
# print(s1[::-1])
# print(s1[2:6:2])
# print(s1[:5])
# print(s1[-1:-5:-1])
# print(s1[-5:])
# print(s1[-7:-3])
#edit and delete a string
#string is immutable , can't change particular value
s1 = "Hello Python"
# s1[0] ="A"
# print(s1)
# s2 = s1[:5]
# print(s2)
# s3 = s1[0]
# print(s3)
# del s1[0]
# del s1[:5]
# del s1
# print(s1)
#operation on string
# s1 = "Asif"
# s2 = "23"
# print(s1 + s2)
# print(s1 * 2)
# print("*" * 10)
#relational operator