EXAMPLE
s1 = "welcome to python"
s2 = "thx for joining"
print(type(s1))
print(s1[1:3])
print(s1.upper())
print(len(s1))
print(s1+" "+s2)
for letter in s1:
print(letter)
print('a' in s1)
print(s1.split())
print("*".join(s1))
print(s1.replace("python", "java"))
OUTPUT
<class 'str'>
el
WELCOME TO PYTHON
17
welcome to python thx for joining
w
e
l
c
o
m
e
t
o
p
y
t
h
o
n
False
['welcome', 'to', 'python']w*e*l*c*o*m*e* *t*o* *p*y*t*h*o*n
welcome to java
No comments:
Post a Comment
Note: only a member of this blog may post a comment.