-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathb3.py
More file actions
65 lines (39 loc) · 1.03 KB
/
b3.py
File metadata and controls
65 lines (39 loc) · 1.03 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
59
60
61
# # slicing
# x = "welcome"
# print(x[3:5])
# txt = "hello world"
# x = txt[2:5]
# print(x)
# x = "welcome"
# print(x[3:])
# a = "hello rahul"
# print(a.upper())
# b = "DEEP"
# print(b.lower())
#remove whitespace
# a = " rahul "
# print(a.strip())
# print(a.replace("r" , "D"))
# print('welcome'.upper())
# combine two string using + operator
# a = "hello"
# b = "rahul"
# c = a+b
# print(c)
# print(a + " " + b)
# we can combine string and number using f- string (format string)
# print(f"hellothere is a format string {30}")
#placeholder can contain modifier , operator , function
#modifier is used to get the number for the decimal places. uses :.2f
# print(f"heellllo{23:.2f}")
# print(f"hellokjdhjg{20*2}")
# escape character \
# print("hello \"hello\"")
#single quote
# print('hi \'hi\'')
# print("hi\\") #backslash
# print("hello\n rahul") # new line
# print("hello \t rahul") # tab sapace
# print("hello\r rahul \r go") # carriage return
# print("\110\220\210\340\120") # octal values
# print("\x45") #hexa value