Python 2
Python 2
I- ·
raise s posite 8 ..
///seGin :
W W3SK-
int : .
, ...
86/po/py : 1628351
· , 00167 ,
:
X ~
t =
Px tr tax-price tax-rate : skind has No a & fur bes case sign
side &fa
· 26
5 / "Hello" /True / 1 . 0 :
160 , (5) aia'de' y (6 :
0012 =
bool float
int string
ifran slob
·
ud or
835 . Oh , at
17 2 '1 01 .
'201
String
&' 1194 Said 51 151714119 012'
-
..
ord (a)- 978 sess , 23"NO 120N yuire :
is &
1 . 2 ... 10 . . .
96 cox [int]
4 3 .
,
. 5,
0 he . -
2 + hj . ..
.
2 z =
128
t
4/2
= 2 . 0 end caod ass and odle a laun ye if (1)
·
7141 da Stifin ()
128 % 10 = 8 ! -128 % 10 =
2 aib = a -
(allb)
+
b se
:2 -
i'v
d
- 162() C) :
salat > 30-
Y
-
x +X
*
1 11 %
,
/1
(N)D + -
X =
y3x x //y=
X-
-
x =
- x+
3 =
3- 6 - X = = 1 + 5084X + =
3 X+ 3 =? 196
None/0/0 0/7)/(53) .
> False + rue =1 bool : < <
g'odk fr
j'c
2 lo false = 0
·
/
LX = H
True
1 3 E
true
.
stonemas i
S
1+ 2 ! = 7 true
true
6'12a1k
·
"Elf
"not's
post
IE back fina :
slady
-
A se A or sina &
&B inc'sna sack · False hid & & & 20 &K A ise A and B not
214) na
Ov
: Braidin-said circa
8 las & sen KIS Nist use shalls star it's arrar
wo es
·
ril and
· True Or LI
·( , .
Round
·
sind eas Sind UTG's input
num-ist (input) 20 K sk
Print (14)
30
II'd'a
statemente
header : : 1 31p6
Foll header
3
Statement 1 165' sinsid 13a k a
ita - . Code ...
d
True
-
False
Statements
if
a
if-else
&
expression
-
...
Some code-
&
Trul If expression :
Fa Isl
State. 1
S+ 1 S+ 2
else :
State
. 2
...
More code..
:
if-elif-3al if S31 I'd
: - elses if jig li
g3 . !
[J ... O
8 "F" format
pu - gas
(s4
in &
[per-month 273
: as
- ski 2006 , All
&
8 . 33. unka 20's
- 8 33
.
(11)
: 311N I'll S
Hello
Print (Helldnlama) Lama > 10246 In
i is alr
>
- Hello World ·
i and & -
: bool , y i j
①
S
s -
-X False si or 1% .
·
"False je' 5
j -
i Q - ↑
- &-
ik &
S ! "X
-
V + rue
~ False Ge
-
kuf -
x'sjy g5s
(Trueji)(1jlj5.
& -
xi) -
.i Q
- ·
ele ,
I don't care Vtrue
Or and -
True
Lo
expres
Jale
103 al Nashe spitals
yo <03961 ,00 accoon ·
· Use
zures busin , rad ris's -
False
Used 17 cok
⑨
· >
or
break
a are :
·
Fill is else see
bitisk ,
Break 213
3r IN"sox
·
(Bod jewel enfid sp tr : continue
: pass
-
A
uni extende Orig
:
Old
-
t
-
: '
os
Alon's 4012
A B C . .
Uppercase
·a -
da fa fac
Greatest common Divisor ·
1's 125k
n= q X1 + r
find
↓
Sen
, T
~ Sa Fina fat :
GCD &
·
140 11343
sig
mino .
(in
> : Index : 1)
&
1 = 0
empty list- [J list)
,
25
1
-
3 -
Opal ·
.
-
1
& peka"
· ↳Seked'en/ank lead) my-list .
Append() : ' for par found is
grades : [ . . . .
I
(3) .
grades(] =
grades(2] + 5 :
Index $304 Eig .
0
x = []
de is x deli
·
Corint skisent .
+
a : I' &
-
* [2 : 8 : 2] 1: ~ .131 when use : Slice
-
1 7
-
cak18 . Se + T D
*
[3
↳
* [3 ]
&
:
[ 2] ::
as
55
Js/1g j42c2k s 2 < 324 =
[S1
2121k3
est
list(range (x y ,
I
))
= :
range
3
I' . 1124
· -
. it d'383 AND
H e llo
1234
indet
0
-
5
-
4 -
3 -
2 -
1
6 job'
&
Season small list Mower
: sidised to spa
↑ 193 / 550/fresne pla : endswith/Startswith &
-1 user & X
opside- i used find
/ K was e
pale : y
:
·
siy D'317
- Da01 & and
.
< p(/2)
·
not in
j5 ·
Split
~21049j31)
OWandT
·
06 20N W
my str =
"Hi"
/Split : ei ,
my lis
+ = list (ny str)
-
"W Djood :
1Sled
x= Hello
Str[0] = k
X
: ank add called do
(spisk
join(i:Slee
·
e
-
> ind'7
·
6TNd 186 Sund in & side
&
- singly index slij
. d Qs)
J19
For
- + 3)
·
gjd
--
list comprehen
x'k
<3 , 9:3172
- ↑
. 12145
-
x37127
enumerate
M[]12 16 . (14) : <132X
E
1 index 319U index
0 1 2
O
-
--
4 =
8 dec 30 + &N
jew S Sit
D's
-
nat-jEjio e) 1330a
-
dise &
·
for iin
range)]
>
-
([0. 1, 2] , [0 1 2) , .
, (0 1
, .
2)
D >R C
* nat =
[] - 5) I
for i in
range (3) : ja j
>a
tmp(st = []
for
j in
range (3) :
= nat ([0 2]] ,
1,
mat .
Append (tmplst
:
113' 24 Fr ifra
[s:
.57
2
,,a , ,
J : >3 4 316)
!
- 10
- 7
mat[2[o]
* (st =
[1 2 3],
,
S & [1 , 2 3) :
11D 636 and
&
,
-
1,
15 + 1 est 34 1S)
-
-
-
&
est Jan I ..
15+ 1
↑ 15t =
[1 2 3] , ,
g -
T1Xi 1st = []
F s
15+ 1 =
1st [ ] :
S - -
- 1st - 5]
D
-C
:
nat1 = nat
nat[0] =
[5 ,
6 , 53
o 5'51
>
-
.
& /j
I
·
sk
·
Si iN23/2 >
IJS
[at[i][j]forj in
range) (3 for ; in
range kjewa
nate =
[] ma + 1
=
[2012 ,
3] [4
. . 5 .
67 [7 8
, , ,
93]
for 1
i in
range) :
trp/st =
[]
for (
rage)
:
in
j
tmp/st Append (mat[i][j]
.
31 S Ne
-
.
·
Break 3 as drassa ston return
GCD
·3
/adisket is sided yay) Jia & abled yadie jad s& spod : return
·
Bisy3/ ise
&
< "3T
swas
gia Gal
:
Scope : D and
·SO SU
! n kr
·
3 G set 10 Celt as "a"
dir set fal sea
X = .... ]
[ x= < ... ] 92 : fantable) side/SW)
I = x[]
:
2 831
. "Like = X
: Cimmutable) sisied/paod
DOS1)
pr sure
FIN3UT SIT -
&SN'sNx
( O Up SJ
-
- ↓ 25 OS (b) 50001)
& at
&
of je uses
-
133018
↓
J
4 3 ,2
, ,
1
ser 'N
Had said
3 SCOT
-
S4355410STDO 3)
p's - single
·
sesini stadas Y
'I !
k '
Y
Cs
· ans as
ja Man
jd
·
O :
Eso) old da
Selection sort/bubble sort -
O(t His
Dy
psa
: