-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathProg6_string.py
More file actions
40 lines (34 loc) · 910 Bytes
/
Prog6_string.py
File metadata and controls
40 lines (34 loc) · 910 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
name = "Ram Krishna Prasad"
# print(len(name))
# print(name[4])
# print(name[0:4])
# print(name[0:18])
# # print(name[200]) # wrong
# print(name[0:200]) # right
# print(name[0:8])
# print(name[0:8:1])
# print(name[:5])
# print(name[0:])
# print(name[::])
# print(name[::3])
# print(name[::-1]) # Print in reverse order
# print(name[::-2])
# print(name.isalnum())
# print(name.isalpha())
# print(name.endswith("Prasad"))
# print(name.count("a"))
# print(name.capitalize())
# print(name.upper())
# print(name.find("P")) # find the position of P
# print(name.replace(" ", "*"))
print(name.rsplit(" ")[1])
# print(type(name.rsplit(" ")))
# fullname = "Abhishek,Sarswat"
# print(fullname[0:fullname.find(",",0)]) # Return first name
i = 23.50
print(type(i))
# print(i.isnumeric())
# print(i.isdecimal())
# print(i.isdigit())
# print(i.isalpha())
# print(i.isalnum())