-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpractpython1.py
More file actions
117 lines (97 loc) · 1.25 KB
/
practpython1.py
File metadata and controls
117 lines (97 loc) · 1.25 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#print(2+2)
"""
name=input('What is your name')
print(name)
Data types-
int
float
bool
str
list
tuple
set
dict
Classes=>
Specialized Data Types
Modules
None
"""
#int
"""
print(type(2+4))
print(2-4)
print(2*4)
print(2/4)
print(2**2)
print(7//4)
print(6%4)
"""
#Math Functions
# round
# abs
# pow
#operator precedence
# ()
# **
# * /
# + -
# auggmented assignment operator
"""
some_value=5
some_value+=5 means some_value=some_value+2
"""
#string
"""_summary_
"hi hello there"
username='supercoder'
long_string='''
wow
0 0
---
'''
"""
#Type conversion
'''
a=str(100)
b=int(a)
c=type(b)
'''
#Escape sequnce
'''
'\' is a escape sequence which tells whatever comes after this is a string
'\t' adds tab space
'''
# str1='ANUBHAV'
# print(str1[0:6])
#LIST
'''
li=[1,2,3,4,5]
l2=[2,45,47]
l3=[1,'a',True,False]
print(l3)
l2.append(100)
print(l2)
l2.insert(1,12)
print(l2)
print(l2.index(12))
l2.sort()
print(l2)
list is a keyword which is used to convert a set to list
'''
#DICTIONARY
'''
dict1={1:'a',2:'b',3:'c'}
print(dict1[1])
print(dict1.get(4,20))
'''
#Tuple
'''
mytuple=(1,2,3,4,5)
print(1 in mytuple)
'''
#Sets
'''
set is a keyword which is used to convert a list to set
'''
my_set={1,2,3,4,5,5}
print(len(my_set))