Commits

Udi Oron committed 9d6089a

added tip about abs()

Comments (0)

Files changed (2)

loops-summary/index.html

 </div>
 <div class="section" id="hot-cold">
 <h2>Hot Cold<a class="headerlink" href="#hot-cold" title="Permalink to this headline">¶</a></h2>
+<div class="admonition tip">
+<p class="first admonition-title">Tip</p>
+<p>The function <tt class="docutils literal"><span class="pre">abs()</span></tt> returns the absolute value of a number
+(It&#8217;s distance from 0):</p>
+<div class="last highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="nb">abs</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
+<span class="go">10</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="nb">abs</span><span class="p">(</span><span class="o">-</span><span class="mi">9</span><span class="p">)</span>
+<span class="go">9</span>
+</pre></div>
+</div>
+</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>
-Search.setIndex({objects:{},terms:{all:[1,2,3,4,5,6,7,9],code:[3,1,4,10],skip:9,scalar:[0,2],concept:0,follow:[1,2,4,6,9,10],primer:0,benevol:3,row:5,regsit:1,program:[0,1,3,5,7,9],present:1,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],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],"while":[0,6],current:1,version:3,"new":[3,4],net:8,gener:[9,2,5],error:1,multiplication_table_html:5,here:[9,6,1],bodi:5,let:3,negtiv:1,ubuntu:[4,10],path:3,valu:[0,2,4],convert:[2,7],credit:4,amount:1,within:[2,10],macintosh:[4,10],apr:4,prefer:10,apt:[4,10],put:5,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,blah:5,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,write:[9,3,1],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,averag:[9,6],bulid: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,divis:9,thank:1,fix:3,fib:9,platform:[3,4],window:[10,4,5],bye:6,might:1,non:3,good:[0,6,4],subtot:1,python:[0,1,2,3,4,5,6,10],auto:9,grand:1,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,win32:4,each:[9,5],understa:2,found:1,mean:[3,5],compil:3,replac:6,hard:4,continu:9,realli:3,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,statist:6,insid:7,advanc:5,free:4,standard:[3,4],quick:[6,7,10],base:5,ask:7,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,progrm:[1,2],differ:[3,4],script:[4,10],interact:[0,6,1,10],mkdir:4,system:4,construct:3,fromat:6,multiplication_t:5,demonstr:0,statement:[7,5],similarli:7,termin:4,"final":[0,1],friend:6,editor:[0,2,4,10],shell:[4,10],consol:10,option:[1,10,5],right_aligned_triangl:7,shelf:6,gotcha:1,copi:4,specifi:[9,5],biggest:9,"short":7,consult:10,udi:0,than:3,wide:3,kind:3,keyword:[9,4],bloat:1,"10x":[0,1,2,4],banana:[6,7],str:7,posit:[6,1],interept:3,seri:[9,6,5],pre:4,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,note:[9,1],also:2,without:[3,4],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,usual:4,someth:7,show:1,carefulli:3,text:[1,10,4,5],session:4,find:[9,6],redirect:5,cell:5,locat:4,execut:[1,4,10],copyright:4,configur:[0,10],should:3,factor:9,folder:[2,4],developmemnt:1,count:[6,5],hit:10,get:[9,1,2,4,10],express:3,watch:[6,7],bear:4,msc:4,youtub:6,requir:3,prime:9,enabl:10,excel:3,bad:[9,3],stuff:[9,4],backword:3,comma:5,set:[0,4,10],inverted_triangl:7,creator:5,frame:7,see:6,mandatori:1,result:6,close:1,best:6,subject:5,closer:1,statu:1,wow:6,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,highlight:[],solv:[0,3,1,7,9],readlin:10,addit:2,both:[9,5],plugin:10,buzz:9,mani:[3,6],toolset:3,browser:5,com:[9,6,4,8],col:5,clone:2,point:3,wall:4,guidelin:[6,1,2,7,5],format:5,python_koan:8,ipython:[0,10],multip:5,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,npp_save:10,unleash:10,emphas:[],rubi:3,great:3,fund:1,understand:[3,1,2],togeth:[6,1,2],workspac:4,els:[6,7],digit_triangl:7,averga:6,"case":6,multi:5,main:4,look:[9,3,4],align:7,bill:1,cash:1,aim:3,defin:3,calcul:6,abov:1,guido:3,everyon:3,loop:[9,0,6,7,5],pyramid:7,ctrl:[6,10],readi:1,them:[1,2],player:1,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],largest:6,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],exampl:[1,7],command:[10,1,2,4,5],thi:[0,1,2,3,4,5,6,7,8,9],choos:[0,3],programm:9,academ:3,latest:3,comment:[2,4],facto:3,just:9,when:[6,1,4],sum2:6,sublimetext:4,collabor:3,human:3,languag:3,concentr:3,easi:[3,10],blog:9,fortran:3,add:[1,2,5],other:[3,4,10],exercis:[0,1,7],overview:4,flowchart:[6,1],save:[4,10],raw_input:[6,2],finder:9,take:1,around:7,udioron:2,read:[9,3,1],game:1,five:9,know:2,press:4,world:[0,3,2,4],bit:4,licens:4,intel:4,like:[9,3],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],sampl:[1,2,5,6,7,9],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,notepad:[4,10],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,"float":0,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,payment:1,avail:3,start:[0,1,3,4,5,9],appl:[6,7],includ:[0,6,9],colder:1,forward:[6,2,7,5],projecteul:8,fizz:9,lowest:9,bottl:4,north:1,half_diamond:7,navig:1,pwd:4,cash_regist:1,line:[1,2,4,5,7,9,10],"true":6,info:6,wise:1,input:[1,2,5,6,7,9],tab:[4,10],"default":4,checkout:1,displai:[1,4,10],record:1,below:[6,7],warmer:1,problem:[0,1,2,3,5,6,7,8,9],similar:3,block:5,featur:[3,1],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],tip:[9,10,7,5],valid:2,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],asterisk:7,docstr:2,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],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"]})