-
Notifications
You must be signed in to change notification settings - Fork 0
/
01_basics.py
74 lines (71 loc) · 1.33 KB
/
01_basics.py
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
62
63
64
65
66
67
68
69
70
71
72
73
74
"""
Uncomment and execute there may be similar variables in use.
Basics of python
"""
"""
a = 10
b = 1.2334
c = 'siddarth'
x = y = z = a
print(a, b, c, z, x, y)
d, e, f=1, 2, 3
print(d, e, f)
tuple = ('hello', 12, 'hahaha')
tuple
print(tuple)
print(tuple[0:2])
print(tuple[1])
t = ('hey', 12)
print(t)
dictionary = {'Name': 'Siddarth', 'Age': 18, 'Sex': 'M'}
print(dictionary.keys())
print(dictionary.values())
print(dictionary)
print(type(a))
print(type(dictionary))
print(type(tuple))
a = 3**4 # ** is Exponentiation operator
print(a)
print(tuple*3) # * is Repetition operator
print(a*3, a*3)
s = 'sidd'
s1 = 'arth'
s = s+s1 # + s Concatenation operator
print(s)
d = {1: 'siddarth', 2: 'kumar', 3: 'Jha'}
print(d)
d[1]= 'sid'
print(d)
list=['hello', 123, 'I am', 456]
print(list)
list[1] = 'hey'
print(list)
dictionary[1] = 'yo!'
print(dictionary)
print('mamamama')
dictionary['Name'] = 'Sid'
print(dictionary)
st = '''hello
I am Your Dad
''' # Multi-line string triple quotation
print(st)
m = 'hey\
buddy' # Multi-line string using Backslash
print(m)
n = None
print(n)
t = True
f = False
print(t, f)
print(type(t))
print(type(n))
dl = {'sp': 'say', 'sa': 'su'}
print(dl['sp'])
x = input()
x = x or 8
r = x / 2
print(r)
"""
d = {'a':2,"a":3}
n = d['a']
print(n)