-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstrings.py
More file actions
50 lines (39 loc) · 944 Bytes
/
strings.py
File metadata and controls
50 lines (39 loc) · 944 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
50
print("""
This is multiline text
This is multiline text
""")
print('''
This is multiline text
This is multiline text
''')
print ("Hello " + "world" + "!")
print("Hello" * 5)
# THis is an escape sequence.
string = "This is a \"escape sequence\" python "
print(string)
# in and not
string = "python is the best programming language"
print('python' in string)
print('best' not in string)
# string indexing
string = "programming"
print(string[0])
print(name[-1])
print(name[1])
# string slicing
print(string[0:6]))
print(string[:6])
print(string[6:])
print(string[-1:-3])
print(name[-1:-4])
# string functions len, lower, upper, islower,isupper, captilize
print(len(string))
print(string.lower())
print(string.upper())
print(string.capitalize())
print(string.islower())
print(string.isupper())
Date = 1991
language="python"
print("Date of first version ", language, " is ", Date)
print(f'Date of first version {language} is {Date}')