-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path03_strings.py
More file actions
58 lines (41 loc) · 1.05 KB
/
03_strings.py
File metadata and controls
58 lines (41 loc) · 1.05 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
# a = "Rishav"
# A sequence of characters is known as ===> Strings
# Strings are immutable
# sortname = a[0:4] #sorting the String
# char = a[0]
# print(sortname)
# print(char)
# slicing of string
# char = a[0:5:2]
# print("Sliced Name: ",char)
# Inbuilt functions in string
# name = "rishav"
# print("Length : ",len(name))
# print(name.endswith("av"))
# print(name.startswith("lsat"))
# print(name.capitalize())
# print(name.lower())
# print(name.upper())
# print(name.find("s"))
# print(name.replace("s" , "z"))
#Practice Questions
# 1.
# name = str(input("Enter You want to enter: "))
# print("Good",name)
# 2.
# name = str(input(": "))
# if(str == ' '):
# print("Double Space")
# else:
# print("No Space")
# 3.
# letter = '''
# Dear <|Name|>
# you are selected
# <|Date|>
# '''
# n = str(input("Enter your name: "))
# print(letter.replace("<|Name|>" , n).replace("<|Date|>" , "05-FEB-2026"))
# 4.
# name = "Rishav hey"
# print(name.find(" "), name.replace(" " , " "))