-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path01stStartofPython.py
More file actions
68 lines (35 loc) · 992 Bytes
/
01stStartofPython.py
File metadata and controls
68 lines (35 loc) · 992 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
print('Hello World!!')
# This is test try for python
# * \n to print in new line
print('Hello\nBye')
# * Bye will be printed in the next line
# * To take input from the user, use
a = input("Enter your name:\n")
print('Hello',a)
# ! comma provides a space!!!!!
a = input('Enter your name again:')
print('Hello',a)
print(len(a))
n = 10
k = 10
if n is k:
print(True)
# * is function checks if the memory address are same or not
print(id(n))
print(id(k))
# ! This proves that python doesn't not store any values in the variables but rather the variables store the memory address of the values (the values pre-exist somewhere)
a = input('Enter your name:\n')
b = int(input('Enter your age:\n'))
print(type(a))
print(type(b))
for i in range(11):
print(2<<i) # * Left Shifting
n = int(input('Enter a no.:'))
print(bin(n))
print(bin(n)[-1])
if bin(n)[-1] == '1':
print('Is odd')
else:
print('Is even')
n = int(input('Enter a no.:'))
print((n<<5) | n)