B~SIC ~PYTHDf'1
PR04RAMS
"!) {l_j-tn on prime -\c> pi,ir'\t \\Olf pct'"'jrri,O o}',..
in"J'llO"' : JY3"ir,t CHol f pct'_'f lTlid o~ s\cr<S : ")
rDo \ ·, " '1rO. nJe Cs-) :
{::o'l' J ''"' 'llQ11J e (\ +•) :
pro,<y\- C'->t ", enct •' ")
p1rin-t 0
@O.fo\ til\5-. ~a mm<f'(
P~oY) piroj'"iorn -\-o swqp 1t-Jo 'Vo'1nab\e$ .
pera j'rO'N) :
'Al = '0
-:: '2.. CJ
ou+pu+ :
VQlV~ QQ : 2.0
Q'.2 , ~ -= 'Valve cc. \J = \o
~nt- (_"vah.1e._ of ':i:2 : '', .ro)
~n+ ( ·-val\Je.. 0~ : ··, '-1)
P~--tt"\oY) ~J1i0rt) ;-o Frd ~ib,nnac, SE?¥1~ UP+o
n -\-enrrY) .
f-Yl<>-po rn : n " i,..,+ ('1,..,pu + ('en-\d -\-,"\e. valve Cl~ 'n' ·." ))
Q =- 0
b ::: I
surn:: o
Coun-\ =- ,
frn n+ ( ,, f:\b()nacd Secy1~ ·. ", end = '
1
J
w'nne (couri+ <::.n) :
Pol n+ ( 5u 07 , er,d '' ")
Coury\· -\-:::. \
a:::b
b::. sum
seim :: a t b
OlJ-\-pu-t: {:\'oonQ~\ ~-eJ '. 0 I I '2 3
':iJ P'd-\n)n p'<StijWO"'> -tD Pif1d rro.)<',rour'r) oC. fu,J o
nurnbe'Y6- ·
P'oOJYOrf) : de,r rrnxi mvV"T) Co b) ·. I
it: a>= b:
rcre-\u'?IY) Q
e\se. ·.
'be-\v11r, b
,:0.-= 10 (l
j::: tOO
p~ n+ C.rno_y, fn\JN") ( ':DI~))
ou~u-\- : 1-c o
~.___________________ _J
L
~tnon paoJ~N) +o c·1t1d 9:lLO~e oC O()J
0<:th.J'"'oo \ "urn be"tr -
[J<roJcrOm : de,(: 9:l\JO"re ( n) :
Poi n-+ ( -· +ne 9:lvo,yc: oC nurnbe-t ,·s ", f'I¼ n)
n ·~ in't-(inpo-r(·'en\e--f nurnbe"" :·· ))
59vo.1f~ ( n)
ou-\-p ut : e n-\-e-Y nu('() be'a : S-
-tt\e. squcn-~ cc num\:)e"< ls : 2.S-
&Gllo1C)~ - · Po<)::i-t O f r \ ~
P'dmon ()15U ;,?ram -to Jernra te a_ <oar)dofl) nu()') t,eo :
p-1iuj1rorn : ,n,poir+ rmnciofY)
\hin+- ( 'aOY) do rt) - raorid i n-t (o, j ))
outpu+ : 1'
I, -
qJ p~+non p1ro,wrn -to cc.kua-lc 01re..o er r\o7o"J\<:
, ~j)'O rn ·. Side I ::. s-
~,de3 = t
#cakua.\-t 1:.) ~ -&=mi -~ea--,rre~erv
5~ (a4:b-+c) / 2..
if, Ca \c.uc,.+i n j a'1!e0
0'W+-- C5 -res Q;)de ~ 3
Q~C\ Cs'¥- (S- sid~1)-¥ C~s -side'lJ (s-side.3))~*0·S"
\n1 <1-\- (-'Ooeq a~ ~o~le ,·.s ·J. o -2.S 1 '/. cnr~a)
P~.\no() piruJ'"b"Q rt) -to ~\()cl ASCII '\fq)\Je oC +he
chorlfc-k:rf
(Ybo~m~ C = 'P'
Poi r)-\- C i'\'\e. Ase II 'Va \ve ·" 4 c. " • is··, o-td( c))
~+non {)oOJ'rof"l) to chsplaj o. atl calanden
proo_JWrn: :t=t,rnpoY+i':J cnlanJe'Y rnodvl~
\Yn()oor ca\af'\d~
~'j = '2C l4 {t.. ~ea']"
# ct, SP lo~ i ca ta ride'"t'
poiry\- ( CQ\Q~derv. mor")-\r) (~':J , mt)'))
ou+pu+ :
f'loVeN')berl 20 I½
JY\O 10 We.. "1\--\ (:"( · '30 Su
'( \ Q..
3
I() I\
s
\ 'L
G
\3
1
\~ Ir ,,
j
I+ \Z \j !2J V2. 2-3
'¼ '2:f 2.6 '2..,':J- '2J 3o
I~ Rjr\-non po{) rl}o lo) +o Gdd tt.uo f'fb 1"l iC€::1 .
poorrom: ::: [[1'2., ':J, 3],
[ ~. f, <;],
[_7 I
q, jJJ
'i - [[ S" J i I 1] I
[ 6 + XJ,
iJJ
I I
[ ~. S-,
<a-esu It = [ L G, 0, 0 ]
1
[ 0 1 0, Q JI
[ () I 0, 0 JJ
8)1r i i YJ 'crO nJ € ( \er, Cx)) ·.
~oo :r , \J 'D"O "Je ( ter, X' ( o] ) ) :
'lre.sul-c (i] [J] -:=. )([i][j] -t y [i](J]
{20--( '15" i () ')e.SU \t :
p1rin-'" c~)
ou+pu-r : [ [ 11 , Is, 4 J , @c,uY10U6- .p ~O()'U mm<ov
[lo, \'l.. jJ 1
l \\ ' \) I I iJJ
iD P~mon Po~J?rOrY) -to rno)(e a s,rnp\e
Ql\uo lccJ-oo •
~j'<fOrn ·. #tn,s t:'Of"\C.+ion adds 4uo num\,~
deP odd ( 'l) , y) :
""oekJ')"C) "12 -+
-# -tn,s {:u0c:-lio<'\ s.>65-\ooc+ -fw\) numb~
der svbsho.c.+ (')), y) -.
tae..¼1sn -y
;¼; 1"Y\\S ~u nc+to<'i mul+·1p1_:1 i1-,JC) f'lum b~
dcl rnutt\plj (')SI ,y) :
~'«} <Xl-f-~
-:l¼ m, s ~u "c....\1 u" ch"' a~ -two n ° t'Y)
dcl' d,,V\Ce c')Q I ':1) :
'crdu"«) (_ , ':J)
p'<S\ n-\- (-' re \ec\- ope'l0-\1°0 ,, )
n+ ('' \. A ctd .,) .. .
p,si Y1-\- ( '2· 8UbS1'Y0 c-\ ·)
@1;"61005- ·poGj-,,ornfY'R/
P" n-\- ( 3 . mu \-\-\ t:>\_j ")
p-nn-r ( ½· cU"'de. '')
l
wh,\e ,1rve :
chotce ::: \npu-t (''en-\e1> choice ('/'l/3) 4) : ')
, "\- v,
"\...o ,' Ce \" ( '1', '2.'' 'j', 'Lr'):
nut'Y) 1 ::: ~\.oa.t (if"\Pof ( en-\e."f c,..01 f\u(Y)b erY ")
Ovm'l = ~loa.t ( i flPut ( .., er)4e--r Se(Dt1d number( ·0
,r ~n.\-
cr"it~ =:: '•' :
lnurn 1 , ,, -\- ., num'l. , '' ~" O.d<i (nom \, nu m2-)
e\; C cno \ t e :: :: \ 2. I : .
()',1n+-(numt, ,,_,, f\um1,, ..,='' 5ube,h-oc:\·· (nurn', C\UM'l-)
e\,~ crn,c-e '3' :
=::
f-h'lrr\ (1'\u<nl, ~~··, f'\urn'l, .\ ~" fnul+\P'~ (1'o("()t, nom1-)
e. \\ ( "~ ( e. :: \ Lt I '.
p1r1 n-\- ( ()\) fl)I , ,, / " , ()um '2 , " ct," ide. (f\um< , vr{")'l)
f\e'X~-Co\CJCt.:;Ho() \opu-\- (-' Luol")-\ -\o c\D af'to-tt"\01 c~\uru-io~
('jesl no) : ")
br're.aK
Mput : Se.\e.ct- open-Q:J--lon-
\ • oc\~
2 . ~ , ¼tftl~ s u 'os\'ll'G c. .\-
2 · fr\ Ol-ttPI
. ct,\V\Qe,
e.n\e--c c\-\oice. (1 I 2.1 3 / <4) : 4
=
eYt\erY ~ir,-s-\- flurt") bert : 3o
en-\e"'J sewund. numbe,,y _. .3
3o·C ( 3.c ::- /CJ·cl