Commits

Udi Oron committed 4b14106

added a note regarding manhattan distance

  • Participants
  • Parent commits 9d6089a

Comments (0)

Files changed (3)

File loops-summary/hot-cold.py

 
 y his hiding y coordinate 0 - an integer  number between -100 and 100
 
+(The input x``=``0 and y``=``0 is not allowed)
+
 The screen is cleared with the following command:
 
 for i in range(100):

File loops-summary/index.html

 </pre></div>
 </div>
 </div>
+<div class="admonition tip">
+<p class="first admonition-title">Tip</p>
+<p class="last">You can use Taxi Cab Geometry (Manhattan distance), which is a very
+simple way to calcluate distance:
+<a class="reference external" href="http://en.wikipedia.org/wiki/Taxicab_geometry">http://en.wikipedia.org/wiki/Taxicab_geometry</a></p>
+</div>
 <div class="problem-name admonition" id="problem-hot-cold.py">
 <p class="first admonition-title">File Name</p>
 <p class="last">hot-cold.py</p>
 <col class="field-body" />
 <tbody valign="top">
 <tr class="field-odd field"><th class="field-name">Problem:</th><td class="field-body"><p class="first">Build a two player hide and seek game!</p>
-<dl class="docutils">
-<dt>Player 1 enters two numbers:</dt>
-<dd><ul class="first last simple">
+<p>Player 1 enters two numbers:</p>
+<blockquote>
+<div><ul class="simple">
 <li><tt class="docutils literal"><span class="pre">x</span></tt> his hiding x coordinate 0 - an integer  number between -100 and 100</li>
 <li><tt class="docutils literal"><span class="pre">y</span></tt> his hiding y coordinate 0 - an integer  number between -100 and 100</li>
 </ul>
-</dd>
-</dl>
+</div></blockquote>
+<p>(The input <tt class="docutils literal"><span class="pre">x``=``0</span></tt> and <tt class="docutils literal"><span class="pre">y``=``0</span></tt> is not allowed)</p>
 <p>The screen is cleared with the following command:</p>
 <div class="highlight-python"><div class="highlight"><pre><span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">100</span><span class="p">):</span>
     <span class="k">print</span>

File searchindex.js

-Search.setIndex({objects:{},terms:{all:[1,2,3,4,5,6,7,9],concept:0,skip:9,scalar:[0,2],code:[3,1,4,10],follow:[1,2,4,6,9,10],primer:0,benevol:3,row:5,regsit:1,program:[0,1,3,5,7,9],averga:6,under:4,melon:7,digit:[9,7],sourc:[3,4],everi:5,string:[0,2,4,5,6,7],fals:[],veri:[3,7],tri:1,magic:9,codinghorror:9,level:3,cmd:4,list:[6,1],iter:9,factori:9,"try":[1,4,5,6,9,8],small:3,round:[9,6],count_count:5,pleas:[1,4],udioron:2,direct:1,rate:7,design:3,further:[0,8],odd:6,click:10,compat:3,what:[3,6,2,7],abc:7,hide:1,appear:6,compar:3,sum:[9,6,2],calcul:6,current:1,version:3,"new":[3,4],net:8,gener:[9,2,5],guido:3,multiplication_table_html:5,here:[9,6,1],bodi:5,let:3,negtiv:1,ubuntu:[4,10],path:3,valu:[0,1,2,4],convert:[2,7],credit:4,amount:1,macintosh:[4,10],apr:4,prefer:10,apt:[4,10],ask:7,instal:[4,10],txt:1,from:[1,2,3,4,6,7,9,10],describ:1,would:[1,7,10],commun:3,distinct:3,regist:1,two:[9,3,1,2],next:[8,0,1,9],few:[3,7],live:3,call:[2,4],recommend:4,diretori:4,type:[3,4,10],average2:6,more:[9,3,6,4,8],better_fram:7,diamond:7,full_current_path:10,peopl:3,cashier:1,notic:4,dictat:3,none:[],word:6,player:1,prepar:[1,2],work:[0,1,4,10],can:[1,2,3,4,5,6,7],drill:[0,2,8],learn:[0,3],root:4,def:[],control:[0,1],podighapgm0:6,prompt:[1,4],want:1,bdfl:3,challeng:[8,1],sudo:[4,10],accept:[1,2],high:3,carrot:6,fibonacci:9,explor:[0,10,8],multiplication_table_html2:5,risk:10,alwai:10,multipl:[9,5],goal:0,comfort:4,divis:9,how:[3,1],hot:1,instead:[9,10],simpl:[0,1,3,5,6,7,9],tbodi:5,updat:1,product:6,stop:[6,1],pythonchalleng:8,after:[9,3,1],varaibl:3,befor:[8,0,1,4,5],mac:4,embrac:3,mai:4,end:[1,5],data:[9,6],grow:5,demonstr:0,"short":7,attempt:1,inform:4,combin:2,deposit:1,allow:3,enter:[9,6,1,10],order:1,elif:7,least:[6,2],help:[1,4],over:3,rang:[9,1,7,4,5],through:0,cold:1,still:3,dynam:3,write:[9,3,1],thank:1,fix:3,fib:9,platform:[3,4],window:[10,4,5],bye:6,might:1,non:3,good:[0,6,4],"return":1,subtot:1,python:[0,1,2,3,4,5,6,10],auto:9,largest:6,dai:1,initi:1,scene:3,"break":6,half:7,now:[1,4],discuss:1,name:[1,2,3,5,6,7,9],anyth:7,fizzbuzz:9,cell:5,win32:4,each:[9,5],understa:2,found:1,mean:[3,5],compil:3,replac:6,hard:4,continu:9,realli:3,tip:[9,1,10,7,5],year:3,our:0,happen:9,todo:1,orient:3,special:2,out:[1,10],variabl:[0,1,2],cell_siz:5,max:6,print:[1,2,4,5,6,7,9],correct:2,backword:3,insid:7,advanc:5,free:4,standard:[3,4],quick:[6,7,10],base:5,put:5,org:[8,2],indent:[10,5],puzzl:0,omit:4,keep:[6,1,10,7,5],turn:[1,7],isn:[9,3],think:1,south:1,first:[9,0,1,4,5],oper:[9,6],softwar:3,major:1,ninit:4,ascii_table_cr:5,number:[0,1,2,5,6,7,9],evolut:3,messag:1,blank:1,simple_fram:7,open:[3,10,4,5],size:5,differ:[3,4],script:[4,10],interact:[0,6,1,10],mkdir:4,system:4,construct:3,fromat:6,appl:[6,7],averag:[9,6],statement:[7,5],similarli:7,termin:4,banana:[6,7],friend:6,includ:[0,6,9],shell:[4,10],consol:10,option:[1,10,5],right_aligned_triangl:7,shelf:6,gotcha:1,copi:4,specifi:[9,5],forward:[6,2,7,5],bulid:7,consult:10,udi:0,than:3,wide:3,kind:3,keyword:[9,4],bloat:1,"10x":[0,1,2,4],"final":[0,1],str:7,posit:[6,1],interept:3,seri:[9,6,5],pre:4,lowest:9,comput:3,ani:[1,4],gedit:4,have:[1,2],tabl:5,need:[8,3,1,2,7],prime_factors_simpl:9,border:5,built:3,checkout:1,note:[9,1],also:2,exampl:[1,7],build:[3,1],which:[9,3,6,5],idustri:3,trivia:3,even:6,begin:5,sure:[1,2,4,10],multipli:[9,6,7],previou:[9,6],paid:1,plan:1,phase:3,squares_squar:5,why:[9,3],simplic:3,clear:1,flow:[0,1],drive:1,doe:6,latest:3,wow:6,show:1,carefulli:3,text:[1,10,4,5],session:4,find:[9,6],redirect:5,absolut:1,locat:4,just:9,copyright:4,configur:[0,10],should:3,factor:9,folder:[2,4],developmemnt:1,info:6,hit:10,get:[9,1,2,4,10],express:3,watch:[6,7],bear:4,youtub:6,requir:3,prime:9,enabl:10,bad:[9,3],stuff:[9,4],statist:6,comma:5,set:[0,4,10],inverted_triangl:7,creator:5,"float":0,frame:7,see:6,mandatori:1,result:6,close:1,best:6,subject:5,closer:1,statu:1,someth:7,behind:3,smallest:6,between:[1,2,5,6,7,9],"import":3,awai:4,approach:3,appreci:6,parent:7,screen:1,aspir:3,lowercas:4,solv:[0,3,1,7,9],problem:[0,1,2,3,5,6,7,8,9],addit:2,both:[9,5],plugin:10,buzz:9,mani:[3,6],browser:5,com:[9,6,4,8],col:5,clone:2,point:3,wall:4,guidelin:[6,1,2,7,5],python_koan:8,ipython:[0,10],featur:[3,1],linux:4,cancel:1,assum:[1,2],better:[10,7,5],java:3,decent:[0,4],invert:7,compos:4,empti:1,quiz:[6,7],compon:3,secret:6,much:[3,1],treat:1,interest:[],basic:0,thead:5,yournam:4,life:3,exercis:[0,1,7],unleash:10,emphas:[],rubi:3,great:3,fund:1,understand:[3,1,2],togeth:[6,1,2],workspac:4,flowchart:[6,1],digit_triangl:7,present:1,"case":6,multi:5,main:4,look:[9,3,4],align:7,bill:1,cash:1,aim:3,defin:3,"while":[0,6],abov:1,error:1,everyon:3,loop:[9,0,6,7,5],pyramid:7,ctrl:[6,10],readi:1,them:[1,2],blah:5,cant:9,cobol:3,digit_squar:7,rid:1,unneed:1,ascii:5,develop:[3,1,2],welcom:[0,1],seek:1,make:[1,2,3,4,5,10],gregmalcolm:8,cross:3,same:5,member:9,html:[9,5],grand:1,pai:[],document:10,complet:1,http:[9,6,2,8],closest:[9,6],nest:[0,7,5],psuedo:3,xyzzi:6,driven:[1,2],user:[6,2],nppexec:10,php:3,squar:[9,7,5],calcluat:[9,6],without:[3,4],command:[10,1,2,4,5],thi:[0,1,2,3,4,5,6,7,8,9],choos:[0,3],programm:9,academ:3,usual:4,comment:[2,4],distanc:1,facto:3,execut:[1,4,10],when:[6,1,4],sum2:6,sublimetext:4,collabor:3,sampl:[1,2,5,6,7,9],human:3,languag:3,concentr:3,easi:[3,10],blog:9,fortran:3,add:[1,2,5],valid:2,npp_save:10,overview:4,els:[6,7],save:[4,10],raw_input:[6,2],finder:9,take:1,around:7,format:5,read:[9,3,1],game:1,five:9,know:2,press:4,world:[0,3,2,4],bit:4,licens:4,like:[9,3],intel:4,header:5,some_funct:[],rossum:3,pyschool:8,integ:[0,1,2,5,6,7,9],edit:[2,4],output:[2,5,6,7,9,10],manag:10,www:[9,6,4,8],right:[7,4],some:[1,2,3,4,8,9,10],back:3,envron:[0,4],warmer:1,home:4,total:1,lead:3,remind:[9,7],disk:4,estim:1,exit:1,outh:[],optoin:1,core:1,process:9,object:3,run:[3,2,4,10],power:[3,10],quit:6,asterisk:7,docstr:2,step:[0,1],repositori:2,about:7,actual:[3,1],column:5,dialog:1,west:1,industri:3,luck:[0,9],produc:5,beign:3,own:[9,10,5],xyz:7,within:[2,10],easy_instal:10,three:9,down:[9,6,1],pair:1,deduct:1,perl:3,your:[1,2,4,5,6,7,10],east:1,accordingli:1,van:3,wai:10,support:10,projecteul:8,payment:1,avail:3,start:[0,1,3,4,5,9],multiplication_t:5,editor:[0,2,4,10],colder:1,biggest:9,progrm:[1,2],fizz:9,"function":1,bottl:4,north:1,half_diamond:7,navig:1,pwd:4,cash_regist:1,line:[1,2,4,5,7,9,10],"true":6,count:[6,5],wise:1,input:[1,2,5,6,7,9],tab:[4,10],"default":4,msc:4,displai:[1,4,10],record:1,below:[6,7],highlight:[],readlin:10,similar:3,block:5,multip:5,creat:[3,7,4],"int":[6,2],dure:1,check_regist:1,file:[1,2,4,5,6,7,9,10],check:[1,2,10],probabl:4,echo:5,again:[9,6,1,10,5],excel:3,other:[3,4,10],rememb:1,pyreadlin:10,test:[1,2],you:[1,2,3,4,5,7,8,9,10],my_input_fil:1,nice:9,draw:[7,5],repeat:7,ilan:0,time:[3,1,4],notepad:[4,10],toolset:3,stai:5,bitbucket:[8,2],coordin:1,directori:4,space:[10,4,5],descript:1,ignor:1,triangl:7,far:1,hello:[0,2,4]},objtypes:{},titles:["Welcome to 10x Python Primer!","Control Flow and Variables Final Exercise","Hello World!","Choose Python","Setting Up A Decent Python Working Envronment","Nested Loops","Interactive Loops","Simple For Loops","Further Exploration","Loops and Numbers","Editor configuration and IPython"],objnames:{},filenames:["index","loops-summary","hello-world","about-python","python-setup","nested-loops","interactive-loops","for-loops","further","loops-and-numbers","power-user"]})
+Search.setIndex({objects:{},terms:{all:[1,2,3,4,5,6,7,9],concept:0,skip:9,scalar:[0,2],code:[3,1,4,10],taxicab_geometri:1,follow:[1,2,4,6,9,10],primer:0,benevol:3,row:5,regsit:1,program:[0,1,3,5,7,9],averga:6,under:4,melon:7,digit:[9,7],sourc:[3,4],everi:5,string:[0,2,4,5,6,7],fals:[],veri:[3,1,7],tri:1,magic:9,codinghorror:9,level:3,cmd:4,list:[6,1],iter:9,factori:9,"try":[1,4,5,6,9,8],small:3,round:[9,6],count_count:5,pleas:[1,4],udioron:2,direct:1,rate:7,design:3,further:[0,8],odd:6,click:10,compat:3,what:[3,6,2,7],abc:7,hide:1,appear:6,compar:3,sum:[9,6,2],calcul:6,current:1,version:3,"new":[3,4],net:8,gener:[9,2,5],guido:3,multiplication_table_html:5,here:[9,6,1],bodi:5,let:3,negtiv:1,ubuntu:[4,10],path:3,valu:[0,1,2,4],convert:[2,7],credit:4,amount:1,macintosh:[4,10],apr:4,prefer:10,apt:[4,10],ask:7,instal:[4,10],txt:1,from:[1,2,3,4,6,7,9,10],describ:1,would:[1,7,10],commun:3,distinct:3,regist:1,two:[9,3,1,2],next:[8,0,1,9],few:[3,7],live:3,call:[2,4],recommend:4,diretori:4,type:[3,4,10],average2:6,more:[9,3,6,4,8],better_fram:7,diamond:7,full_current_path:10,peopl:3,cashier:1,notic:4,dictat:3,none:[],word:6,player:1,prepar:[1,2],work:[0,1,4,10],can:[1,2,3,4,5,6,7],drill:[0,2,8],learn:[0,3],cab:1,root:4,def:[],control:[0,1],podighapgm0:6,prompt:[1,4],want:1,bdfl:3,challeng:[8,1],sudo:[4,10],accept:[1,2],high:3,carrot:6,fibonacci:9,explor:[0,10,8],multiplication_table_html2:5,risk:10,alwai:10,multipl:[9,5],goal:0,comfort:4,divis:9,how:[3,1],hot:1,instead:[9,10],simpl:[0,1,3,5,6,7,9],tbodi:5,updat:1,product:6,stop:[6,1],pythonchalleng:8,after:[9,3,1],varaibl:3,befor:[8,0,1,4,5],mac:4,embrac:3,mai:4,end:[1,5],data:[9,6],grow:5,demonstr:0,"short":7,attempt:1,inform:4,combin:2,deposit:1,allow:[3,1],enter:[9,6,1,10],order:1,elif:7,least:[6,2],help:[1,4],over:3,rang:[9,1,7,4,5],through:0,cold:1,still:3,dynam:3,write:[9,3,1],thank:1,fix:3,fib:9,platform:[3,4],window:[10,4,5],bye:6,might:1,non:3,good:[0,6,4],"return":1,subtot:1,python:[0,1,2,3,4,5,6,10],auto:9,largest:6,dai:1,initi:1,scene:3,"break":6,half:7,now:[1,4],discuss:1,name:[1,2,3,5,6,7,9],anyth:7,fizzbuzz:9,cell:5,win32:4,each:[9,5],understa:2,found:1,mean:[3,5],compil:3,replac:6,hard:4,continu:9,realli:3,tip:[9,1,10,7,5],year:3,our:0,happen:9,todo:1,orient:3,special:2,out:[1,10],variabl:[0,1,2],cell_siz:5,max:6,print:[1,2,4,5,6,7,9],correct:2,backword:3,insid:7,advanc:5,free:4,standard:[3,4],quick:[6,7,10],base:5,put:5,org:[8,1,2],indent:[10,5],puzzl:0,omit:4,keep:[6,1,10,7,5],turn:[1,7],isn:[9,3],geometri:1,think:1,south:1,first:[9,0,1,4,5],oper:[9,6],softwar:3,major:1,ninit:4,ascii_table_cr:5,number:[0,1,2,5,6,7,9],evolut:3,messag:1,blank:1,simple_fram:7,open:[3,10,4,5],size:5,differ:[3,4],script:[4,10],interact:[0,6,1,10],mkdir:4,system:4,construct:3,fromat:6,appl:[6,7],averag:[9,6],statement:[7,5],similarli:7,termin:4,banana:[6,7],friend:6,includ:[0,6,9],shell:[4,10],consol:10,option:[1,10,5],right_aligned_triangl:7,shelf:6,gotcha:1,copi:4,specifi:[9,5],forward:[6,2,7,5],bulid:7,consult:10,udi:0,than:3,wide:3,kind:3,keyword:[9,4],bloat:1,"10x":[0,1,2,4],"final":[0,1],str:7,posit:[6,1],interept:3,seri:[9,6,5],pre:4,lowest:9,comput:3,ani:[1,4],gedit:4,have:[1,2],tabl:5,need:[8,3,1,2,7],prime_factors_simpl:9,border:5,built:3,checkout:1,note:[9,1],also:2,exampl:[1,7],build:[3,1],which:[9,3,1,6,5],idustri:3,trivia:3,even:6,begin:5,sure:[1,2,4,10],multipli:[9,6,7],previou:[9,6],paid:1,plan:1,phase:3,squares_squar:5,why:[9,3],simplic:3,clear:1,flow:[0,1],drive:1,doe:6,latest:3,wow:6,show:1,carefulli:3,text:[1,10,4,5],session:4,find:[9,6],redirect:5,absolut:1,locat:4,just:9,copyright:4,configur:[0,10],should:3,factor:9,folder:[2,4],developmemnt:1,info:6,hit:10,get:[9,1,2,4,10],express:3,watch:[6,7],bear:4,youtub:6,requir:3,prime:9,enabl:10,bad:[9,3],stuff:[9,4],statist:6,comma:5,wiki:1,set:[0,4,10],inverted_triangl:7,creator:5,"float":0,frame:7,see:6,mandatori:1,result:6,close:1,best:6,subject:5,closer:1,statu:1,someth:7,wikipedia:1,behind:3,smallest:6,between:[1,2,5,6,7,9],"import":3,awai:4,approach:3,appreci:6,parent:7,screen:1,aspir:3,lowercas:4,solv:[0,3,1,7,9],problem:[0,1,2,3,5,6,7,8,9],addit:2,both:[9,5],plugin:10,buzz:9,mani:[3,6],browser:5,com:[9,6,4,8],col:5,clone:2,point:3,wall:4,guidelin:[6,1,2,7,5],python_koan:8,ipython:[0,10],featur:[3,1],linux:4,cancel:1,assum:[1,2],better:[10,7,5],java:3,decent:[0,4],invert:7,compos:4,empti:1,quiz:[6,7],compon:3,secret:6,much:[3,1],treat:1,interest:[],basic:0,thead:5,yournam:4,life:3,exercis:[0,1,7],unleash:10,emphas:[],rubi:3,great:3,fund:1,understand:[3,1,2],togeth:[6,1,2],workspac:4,flowchart:[6,1],digit_triangl:7,present:1,"case":6,multi:5,main:4,look:[9,3,4],align:7,bill:1,cash:1,aim:3,defin:3,"while":[0,6],abov:1,error:1,everyon:3,loop:[9,0,6,7,5],pyramid:7,ctrl:[6,10],readi:1,them:[1,2],blah:5,cant:9,cobol:3,digit_squar:7,rid:1,unneed:1,ascii:5,develop:[3,1,2],welcom:[0,1],seek:1,make:[1,2,3,4,5,10],gregmalcolm:8,cross:3,same:5,member:9,html:[9,5],grand:1,pai:[],document:10,complet:1,http:[9,6,1,2,8],closest:[9,6],nest:[0,7,5],psuedo:3,xyzzi:6,driven:[1,2],user:[6,2],nppexec:10,php:3,squar:[9,7,5],calcluat:[9,6,1],without:[3,4],command:[10,1,2,4,5],thi:[0,1,2,3,4,5,6,7,8,9],choos:[0,3],programm:9,academ:3,usual:4,taxi:1,comment:[2,4],distanc:1,facto:3,execut:[1,4,10],when:[6,1,4],sum2:6,sublimetext:4,collabor:3,sampl:[1,2,5,6,7,9],human:3,languag:3,concentr:3,easi:[3,10],blog:9,fortran:3,add:[1,2,5],valid:2,npp_save:10,overview:4,els:[6,7],save:[4,10],raw_input:[6,2],finder:9,take:1,around:7,format:5,read:[9,3,1],game:1,five:9,know:2,press:4,world:[0,3,2,4],bit:4,licens:4,like:[9,3],intel:4,header:5,some_funct:[],rossum:3,pyschool:8,integ:[0,1,2,5,6,7,9],edit:[2,4],output:[2,5,6,7,9,10],manag:10,www:[9,6,4,8],right:[7,4],some:[1,2,3,4,8,9,10],back:3,envron:[0,4],warmer:1,home:4,total:1,lead:3,remind:[9,7],disk:4,estim:1,exit:1,outh:[],optoin:1,core:1,process:9,object:3,run:[3,2,4,10],power:[3,10],quit:6,asterisk:7,docstr:2,step:[0,1],repositori:2,about:7,actual:[3,1],column:5,dialog:1,west:1,industri:3,luck:[0,9],produc:5,beign:3,own:[9,10,5],xyz:7,within:[2,10],easy_instal:10,three:9,down:[9,6,1],pair:1,deduct:1,perl:3,your:[1,2,4,5,6,7,10],east:1,accordingli:1,van:3,wai:[1,10],support:10,projecteul:8,payment:1,avail:3,start:[0,1,3,4,5,9],multiplication_t:5,editor:[0,2,4,10],colder:1,biggest:9,progrm:[1,2],fizz:9,"function":1,bottl:4,north:1,half_diamond:7,navig:1,pwd:4,cash_regist:1,line:[1,2,4,5,7,9,10],"true":6,count:[6,5],wise:1,input:[1,2,5,6,7,9],tab:[4,10],"default":4,msc:4,displai:[1,4,10],record:1,below:[6,7],highlight:[],readlin:10,similar:3,block:5,multip:5,creat:[3,7,4],"int":[6,2],dure:1,check_regist:1,file:[1,2,4,5,6,7,9,10],check:[1,2,10],probabl:4,echo:5,again:[9,6,1,10,5],excel:3,other:[3,4,10],rememb:1,pyreadlin:10,test:[1,2],you:[1,2,3,4,5,7,8,9,10],my_input_fil:1,manhattan:1,nice:9,draw:[7,5],repeat:7,ilan:0,time:[3,1,4],notepad:[4,10],toolset:3,stai:5,bitbucket:[8,2],coordin:1,directori:4,space:[10,4,5],descript:1,ignor:1,triangl:7,far:1,hello:[0,2,4]},objtypes:{},titles:["Welcome to 10x Python Primer!","Control Flow and Variables Final Exercise","Hello World!","Choose Python","Setting Up A Decent Python Working Envronment","Nested Loops","Interactive Loops","Simple For Loops","Further Exploration","Loops and Numbers","Editor configuration and IPython"],objnames:{},filenames:["index","loops-summary","hello-world","about-python","python-setup","nested-loops","interactive-loops","for-loops","further","loops-and-numbers","power-user"]})