-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBasics File2.py
130 lines (101 loc) · 1.55 KB
/
Basics File2.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
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
118
119
120
121
122
123
124
125
126
127
128
129
130
>>> import keyword
>>> keyword.iskeyword("sample")
False
>>> keyword.kwlist
['False', 'None', 'True', '__peg_parser__', 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']
>>> len(keyword.kwlist)
36
>>> 7+3
10
>>> a=10000000000000
>>> a
10000000000000
>>> 3+2
5
>>> 3-2
1
>>> 3*3
9
>>> 2/3
0.6666666666666666
>>> 2//3
0
>>> 2%3
2
>>> 4//2
2
>>> 4/2
2.0
>>> 2**3
8
>>> #PEMDAS
>>> #P=Paranthesis
>>> #E-Exp
>>> #M-Mul
>>> #D-Div
>>> #A-Add
>>> #S-Subt
>>> a='hi'
>>> b='everyone'
>>> a+b
'hieveryone'
>>> a+''+b
'hieveryone'
>>> a+' '+b
'hi everyone'
>>> a='fun'
>>> a*3
'funfunfun'
>>> 'fun'*3
'funfunfun'
>>> b='fun'*3
>>> print (b)
funfunfun
>>> (7*3600)+(21*60)+37
26497
>>> a=7
>>> b=21
>>> c=37
>>> d=(a*3600)+(b*60)+c
>>> d
26497
>>> length=4
>>> width=7
>>> perimeter=2*(length+width)
>>> perimeter
22
>>> rad=8
>>> pi=3.14
>>> circum=2*pi*rad
>>> circum
50.24
>>> rad=8
>>> pi=3.14
>>> area=pi*rad*rad
>>> area
200.96
>>> p=1000
>>> r=7
>>> y=10
>>> value=p*(1+(0.01*r))*y
>>> value
10700.0
>>> str='Joe Warren is'
>>> a='52'
>>> str1='years old.'
>>> value=str+' '+a+' '+str1
>>> value
'Joe Warren is 52 years old.'
>>> str1="My name is"
>>> str2="Joe"
>>> str3="Warren"
>>> value=str1+' '+str2+' '+str3
>>> value
'My name is Joe Warren'
>>> x0=2
>>> y0=2
>>> x1=5
>>> y1=6
>>> value=((x0-x1)*(x0-x1))+((y0-y1)*(y0-y1))
>>> value
25