当前位置:高等教育资讯网  >  中国高校课件下载中心  >  大学文库  >  浏览文档

上海交通大学:《Computational Thinking and Approach》教学资源(课件讲稿)Something You Should Know

资源类别:文库,文档格式:PDF,文档页数:21,文件大小:302.58KB,团购合买
点击下载完整版文档(PDF)

上游充通大 ParisTech SHANGHAI JIAO TONG UNIVERSITY INSTITUT DES SCIENCES ET TECHNOLOGIES PARIS INSTITUTE OF TECHNOLOGY Something You Should Know Computational Thinking and Approach

Something You Should Know Computational Thinking and Approach

上游充通大 ParisTech SHANGHAI JIAO TONG UNIVERSITY INSTITUT DES SCIENCES ET TECHNOLOGIES PARIS INSTITUTE OF TECHNOLOGY ntroduction 。Program paradigms -Imperative,functional,declarative,object-oriented ·Python Multi-paradimed Interpreter:.py is translated (not compiled)to byte code,and then is execute on Virtual machine of Python Software development process

Introduction • Program paradigms – Imperative, functional, declarative, object-oriented • Python – Multi-paradimed – Interpreter: .py is translated (not compiled) to byte code, and then is execute on Virtual machine of Python • Software development process

上游充通大 ParisTech SHANGHAI JIAO TONG UNIVERSITY INSTITUT DES SCIENCES ET TECHNOLOGIES PARIS INSTITUTE OF TECHNOLOGY ntroduction Three key elements of Computer Science Design,Analysis,experimentation Two key elements of to develop a solution to a problem Data structure and Algorithm 。Modular programing 。Algorithm analysis Time and Space Big-O notation

Introduction • Three key elements of Computer Science – Design, Analysis, experimentation • Two key elements of to develop a solution to a problem – Data structure and Algorithm • Modular programing • Algorithm analysis – Time and Space – Big-O notation

上游充通大 ParisTech SHANGHAI JIAO TONG UNIVERSITY INSTITUT DES SCIENCES ET TECHNOLOGIES PARIS INSTITUTE OF TECHNOLOGY BUILT-IN TYPE AND EXPRESSIONS

BUILT-IN TYPE AND EXPRESSIONS

上游充通大 ParisTech SHANGHAI JIAO TONG UNIVERSITY INSTITUT DES SCIENCES ET TECHNOLOGIES PARIS INSTITUTE OF TECHNOLOGY Object,variable and type Object is everywhere in Python Variable is a label that you could stick to any object Object has a type,variables do not have it The type of the object referred by 'toto' Mutable and immutable objects >>type('Hello,World!) Int,float,string,tuple >>>type(17) -List,dictionary,others... >>type(1.02)

Object, variable and type • Object is everywhere in Python • Variable is a label that you could stick to any object • Object has a type, variables do not have it – The type of the object referred by ‘toto’ • Mutable and immutable objects – Int, float, string, tuple – List, dictionary, others… >>> type('Hello, World!') >>> type(17) >>> type(1.02)

上游充通大 ParisTech SHANGHAI JIAO TONG UNIVERSITY INSTITUT DES SCIENCES ET TECHNOLOGIES PARIS INSTITUTE OF TECHNOLOGY Names (identifier) 。Rule: Every identifier must begin with a letter or underscore (")followed by any sequence of letters,digits,or underscores. ·Reserved word Words used in controls:if,else,try... -Words used to specify:global,class Types are not reserved word list,float

Names (identifier) • Rule: – Every identifier must begin with a letter or underscore (“_”), followed by any sequence of letters, digits, or underscores. • Reserved word – Words used in controls: if, else, try… – Words used to specify: global, class • Types are not reserved word – list, float…

上游充通大 ParisTech SHANGHAI JIAO TONG UNIVERSITY INSTITUT DES SCIENCES ET TECHNOLOGIES PARIS INSTITUTE OF TECHNOLOGY Order of the execution Operations Low Operator Description (from lowest precedences to highest precedences lambda Lambda expression or Boolean OR and Boolean AND not x Boolean NOT 1n,not1n,18,1snot,,>=,◇,1=,= Comparisons,including membership tests and identity tests, Bitwise OR A Bitwise XOR Bitwise AND > Shifts Addition and subtraction *,1,/1,8 Multiplication,division,remainder +X-X ~X Positive,negative,bitwise NOT ★女 Exponentiation x[index],x[index:index],x(arguments...),x.attribute Subscription,slicing,call,attribute reference High (expressions...),[expressions...],(key:datum...},expressions... Binding or tuple display,list display,dictionary display,string conversion

Order of the execution Operations Low High

上游充通大 ParisTech SHANGHAI JIAO TONG UNIVERSITY INSTITUT DES SCIENCES ET TECHNOLOGIES PARIS INSTITUTE OF TECHNOLOGY Operation Basic operation on different type objects ·Type of the results: -bool->Int->double->float.... -20/7&20.0/7 Never trust =with float Application on mutable and immutable object: -a=(1,2) a=[1,2] -b=(3,4) b=[3,4] a+=b,a=a+b a+=b,a=a+b

Operation • Basic operation on different type objects • Type of the results: – bool->Int->double->float…. – 20/7 & 20.0/7 • Never trust == with float • Application on mutable and immutable object: – a=(1,2) – b=(3,4) – a+=b, a=a+b a=[1,2] b=[3,4] a+=b, a=a+b

上降充通大 ParisTech SHANGHAI JIAO TONG UNIVERSITY INSTITUT DES SCIENCES ET TECHNOLOGIES PARIS INSTITUTE OF TECHNOLOGY Very important objects 。 String File object ·List Mutable!!!! Dictionary All functions associated with: -append,remove,len,index [][][5],[:4],slicing,negative index

Very important objects • String • File object • List – Mutable!!!! • Dictionary • All functions associated with: – append, remove, len, index – [], [:],[:5], [::4], slicing, negative index

上游充通大 ParisTech SHANGHAI JIAO TONG UNIVERSITY INSTITUT DES SCIENCES ET TECHNOLOGIES PARIS INSTITUTE OF TECHNOLOGY String Formatting 。Format%value %. ·%s,%d,%f,%10.5f >>>"compare号10fand号0.20f"号(3.14,3.14) 10

String Formatting • Format % value • %. • %s, %d, %f, %10.5f >>> “compare %10f and %0.20f” % (3.14, 3.14) 10

点击下载完整版文档(PDF)VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
共21页,试读已结束,阅读完整版请下载
相关文档

关于我们|帮助中心|下载说明|相关软件|意见反馈|联系我们

Copyright © 2008-现在 cucdc.com 高等教育资讯网 版权所有