How to Think Like a Computer Scientist: Learning with Python 3»

Size: px
Start display at page:

Download "How to Think Like a Computer Scientist: Learning with Python 3»"

Transcription

1 How to Think Like a Computer Scientist How to Think Like a Computer Scientist: Learning with Python How to Think Like a Computer Scientist: Learning with Python» next index How to Think Like a Computer Scientist Learning with Python (RLE) Version date: November 0 by Peter Wentworth, Jeffrey Elkner, Allen B. Downey, and Chris Meyers (based on nd edition by Jeffrey Elkner, Allen B. Downey, and Chris Meyers) Corresponding author: Source for this RLE version: https://code.launchpad.net/~thinkcspy-rle-team/thinkcspy/thinkcspy- rle Search Page Copyright Notice Foreword Preface Preface- This Rhodes Local Edition (RLE) of the book Contributor List Chapter The way of the program Chapter Variables, expressions, and statements Chapter Hello, little turtles! Chapter Functions Chapter Conditionals Chapter Fruitful functions Chapter 7 Iteration Chapter 8 Strings Chapter 9 Tuples Chapter 0 Event handling Chapter Lists Chapter Modules Chapter Files Chapter List Algorithms Chapter Classes and Objects - the Basics Chapter Classes and Objects - Digging a little deeper Chapter 7 PyGame 9:: PM]

2 How to Think Like a Computer Scientist How to Think Like a Computer Scientist: Learning with Python Chapter 8 Recursion Chapter 9 Exceptions Chapter 0 Dictionaries Chapter Even more OOP Chapter Collections of Objects Chapter Inheritance Chapter Linked Lists Chapter Stacks Chapter Queues Chapter 7 Trees Appendix A Debugging Appendix B An odds-and-ends Workbook Appendix C Configuring Ubuntu for Python Development Appendix D Customizing and Contributing to the Book Appendix E Some Tips, Tricks, and Common Errors GNU Free Document License Search Page How to Think Like a Computer Scientist: Learning with Python» next index Copyright 0, Peter Wentworth, Jeffrey Elkner, Allen B. Downey and Chris Meyers. Created using Sphinx :: PM]

3 Index How to Think Like a Computer Scientist: Learning with Python How to Think Like a Computer Scientist: Learning with Python» index Index Symbols A B C D E F G H I J K L M N O P Q R S T U V W Symbols n + sequence A abbreviated assignment abecedarian series abstract data type (ADT) accumulator algorithm, [], [], [] deterministic aliases, [], [] alternative execution ambiguity animation rate argument, [] argv assignment, [] tuple assignment statement, [], [] assignment token attribute, [], [], [], [], [] B baked animation bar chart base case, [] binary operator binary search binary tree bind blit block, [] body, [], [], [] boolean expression, [] boolean function, [] boolean value, [] branch, [] break statement breakpoint bug, [] builtin scope bump bytecode C call graph canvas, [] cargo chained conditional, [] character chatterbox function child child class chunking, [] class, [] class attribute client composition, [], [] (of functions) composition of functions compound data type, [], [] compound statement, [] body header computation pattern concatenate concatenation, [] condition, [] conditional 9:: PM]

4 Index How to Think Like a Computer Scientist: Learning with Python clone, [] collection, [] command line command line argument command prompt comment, [] comments comparison of strings comparison operator, [] compile, [] chained conditional branching conditional execution conditional statement, [] conditionals nested constant time constructor continue statement, [] control flow, [] copy deep shallow counter counting pattern cursor, [] D data structure, [] recursive data type, [] dead code, [] debugging, [], [] decrement deep copy deep equality, [] default value, [] definite iteration definition function, [] recursive del statement, [] delimiter, [], [] deterministic algorithm development plan, [] dictionary, [] dir function directory, [] docstring, [], [] dot notation, [] dot operator, [] dot product Doyle, Arthur Conan E element, [], [] elif else embedded reference encapsulate encapsulation encode enumerate equality deep shallow escape sequence, [] eureka traversal evaluate event, [] exception, [], [], [] handling executable expression, [], [] boolean 9:: PM]

5 Index How to Think Like a Computer Scientist: Learning with Python F fibonacci numbers field width FIFO file, [] text file handle file system float, [], [] flow of execution, [], [] for loop, [], [], [], [], [] for loop traversal (for) formal language, [] formatting strings fractal Cesaro torn square Sierpinski triangle frame frame rate fruitful function, [] fully qualified name function, [], [], [] argument composition len parameter pure function call function composition, [] function definition, [], [] function type functional programming style fundamental ambiguity theorem G game loop, [] generalization, [] generalize generic data structure global scope H hand trace handle, [] handle an exception handler, [] handling an exception header line help helper high-level language, [] Holmes, Sherlock I if if statement immediate mode immutable, [], [], [] immutable data type, [] implementation import statement, [], [], [], [] in and not in operator (in, not in) in operator increment incremental development, [] indefinite iteration initialization (of a variable) initializer method input input dialog instance, [], [] instantiate int, [], [] integer integer division, [] Intel interface interpret, [] 9:: PM]

6 Index How to Think Like a Computer Scientist: Learning with Python index, [], [], [] negative indexing ([]) infinite loop, [] infinite recursion, [] infix inheritance invariant invoke, [] is operator item, [], [] item assignment iteration, [], [] J join justification K key, [] key-value pair, [] keyword, [] L leaf len function length function (len) level lifetime, [] linear linear search linear time link linked list linked queue Linux list, [], [] append nested, [] list index list traversal, [] literalness local scope local variable, [], [] logarithm logical operator, [], [] loop, [] loop body, [] loop variable, [] low-level language, [] M Make Way for Ducklings mapping type, [] matrix, [] McCloskey, Robert memo, [] Merge algorithm meta-notation, [] method, [], [], [] middle-test loop mode modifier, [], [], [] module, [], [], [] modulus operator, [] mutable, [], [] mutable data type, [], [] N namespace, [] naming collision natural language, [] negative index nesting newline, [] Newton's method node 9:: PM]

7 Index How to Think Like a Computer Scientist: Learning with Python nested conditionals nested list, [], [] nested loop non-volatile memory None, [] normalized O object, [], [], [] object code object-oriented language object-oriented programming, [] objects and values operand, [] operations on strings operator, [] comparison in logical, [] modulus operator overloading optional parameter, [] order of operations P parameter, [], [] optional parent parent class parse, [], [] pass statement path pattern pattern of computation Pentium pixel poetry poll, [] polymorphic portability portable post-test loop postfix postorder pre-test loop precondition prefix notation preorder print function priority queue Priority Queue probe problem solving program, [], [] program development program tracing programming language promise, [], [] prompt prose provider pure function, [] PyGame PyScripter single stepping Python shell Q queue Queue queueing policy R raise random numbers range recursive definition, [] redundancy refactor 9:: PM]

8 Index How to Think Like a Computer Scientist: Learning with Python range function, [] reassignment, [] rectangle recursion, [] infinite recursive call, [] recursive data structure refactoring code return statement, [] return value, [] root rules of precedence, [] runtime error, [], [], [] S safe language scaffolding, [], [] scalar multiplication scope builtin global local script semantic error, [] semantics, [] sequence, [], [] shallow copy shallow equality, [] short-circuit evaluation, [] shuffle siblings side effect, [] single-step singleton slice, [], [] slicing ([:]) socket source code split sprite stack diagram state state snapshot, [] statement, [] assignment continue del, [] if import, [] pass return statement block statement: break step size str, [] string string comparison (>, <, >=, <=, ==,!=) string formatting string module string operations string slice strings and lists style subexpression sublist, [] subscript operator substring surface, [] syntax, [] syntax error, [] T tab, [] table temporary variable, [] terminating condition test suite Test-driven development traverse trichotomy triple quoted string truncation try... except try... except... finally 9:: PM]

9 Index How to Think Like a Computer Scientist: Learning with Python test-driven development (TDD) text file, [] token, [], [] trace traceback tracing a program traversal, [] tuple, [] assignment return value tuple assignment turtle module two-dimensional table type conversion type conversion, [] type converter functions U underscore character unit testing unit tests unreachable code V value, [], [], [] boolean variable, [] local, [] temporary variable name veneer volatile memory W while loop while statement whitespace wrapper wrapping code in a function, [] How to Think Like a Computer Scientist: Learning with Python» index Copyright 0, Peter Wentworth, Jeffrey Elkner, Allen B. Downey and Chris Meyers. Created using Sphinx :: PM]

10 Copyright Notice How to Think Like a Computer Scientist: Learning with Python How to Think Like a Computer Scientist: Learning with Python» previous next index Copyright Notice Copyright (C) Peter Wentworth, Jeffrey Elkner, Allen B. Downey and Chris Meyers. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version. or any later version published by the Free Software Foundation; with Invariant Sections being Foreword, Preface, and Contributor List, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License. How to Think Like a Computer Scientist: Learning with Python» previous next index Copyright 0, Peter Wentworth, Jeffrey Elkner, Allen B. Downey and Chris Meyers. Created using Sphinx ::0 PM]

11 Search How to Think Like a Computer Scientist: Learning with Python How to Think Like a Computer Scientist: Learning with Python» index Search From here you can search these documents. Enter your search words into the box below and click "search". Note that the search function will automatically search for all of the words. Pages containing fewer words won't appear in the result list. How to Think Like a Computer Scientist: Learning with Python» index Copyright 0, Peter Wentworth, Jeffrey Elkner, Allen B. Downey and Chris Meyers. Created using Sphinx :: PM]

12 Foreword How to Think Like a Computer Scientist: Learning with Python How to Think Like a Computer Scientist: Learning with Python» previous next index Foreword By David Beazley As an educator, researcher, and book author, I am delighted to see the completion of this book. Python is a fun and extremely easy-to-use programming language that has steadily gained in popularity over the last few years. Developed over ten years ago by Guido van Rossum, Python s simple syntax and overall feel is largely derived from ABC, a teaching language that was developed in the 980 s. However, Python was also created to solve real problems and it borrows a wide variety of features from programming languages such as C++, Java, Modula-, and Scheme. Because of this, one of Python s most remarkable features is its broad appeal to professional software developers, scientists, researchers, artists, and educators. Despite Python s appeal to many different communities, you may still wonder why Python? or why teach programming with Python? Answering these questions is no simple task especially when popular opinion is on the side of more masochistic alternatives such as C++ and Java. However, I think the most direct answer is that programming in Python is simply a lot of fun and more productive. When I teach computer science courses, I want to cover important concepts in addition to making the material interesting and engaging to students. Unfortunately, there is a tendency for introductory programming courses to focus far too much attention on mathematical abstraction and for students to become frustrated with annoying problems related to low-level details of syntax, compilation, and the enforcement of seemingly arcane rules. Although such abstraction and formalism is important to professional software engineers and students who plan to continue their study of computer science, taking such an approach in an introductory course mostly succeeds in making computer science boring. When I teach a course, I don t want to have a room of uninspired students. I would much rather see them trying to solve interesting problems by exploring different ideas, taking unconventional approaches, breaking the rules, and learning from their mistakes. In doing so, I don t want to waste half of the semester trying to sort out obscure syntax problems, unintelligible compiler error messages, or the several hundred ways that a program might generate a general protection fault. One of the reasons why I like Python is that it provides a really nice balance between the practical and the conceptual. Since Python is interpreted, beginners can pick up the language and start doing neat things almost immediately without getting lost in the problems of compilation and linking. Furthermore, Python comes with a large library of modules that can be used to do all sorts of tasks ranging from web-programming to graphics. Having such a practical focus is a great way to engage students and it allows them to complete significant projects. However, Python can also serve as an excellent foundation for introducing important computer science concepts. Since Python fully supports procedures and classes, students can be gradually introduced to topics such as procedural abstraction, data structures, and object-oriented programming all of which are applicable to later courses on Java or C++. Python even borrows a number of features from functional programming languages and can be used to introduce concepts that would be covered in more detail in courses on Scheme and Lisp. In reading Jeffrey s preface, I am struck by his comments that Python allowed him to see a higher level of success and a lower level of frustration and that he was able to move faster with better results. 9::7 PM]

13 Foreword How to Think Like a Computer Scientist: Learning with Python Although these comments refer to his introductory course, I sometimes use Python for these exact same reasons in advanced graduate level computer science courses at the University of Chicago. In these courses, I am constantly faced with the daunting task of covering a lot of difficult course material in a blistering nine week quarter. Although it is certainly possible for me to inflict a lot of pain and suffering by using a language like C++, I have often found this approach to be counterproductive especially when the course is about a topic unrelated to just programming. I find that using Python allows me to better focus on the actual topic at hand while allowing students to complete substantial class projects. Although Python is still a young and evolving language, I believe that it has a bright future in education. This book is an important step in that direction. David Beazley University of Chicago Author of the Python Essential Reference How to Think Like a Computer Scientist: Learning with Python» previous next index Copyright 0, Peter Wentworth, Jeffrey Elkner, Allen B. Downey and Chris Meyers. Created using Sphinx ::7 PM]

14 Preface How to Think Like a Computer Scientist: Learning with Python How to Think Like a Computer Scientist: Learning with Python» previous next index Preface By Jeffrey Elkner This book owes its existence to the collaboration made possible by the Internet and the free software movement. Its three authors a college professor, a high school teacher, and a professional programmer never met face to face to work on it, but we have been able to collaborate closely, aided by many other folks who have taken the time and energy to send us their feedback. We think this book is a testament to the benefits and future possibilities of this kind of collaboration, the framework for which has been put in place by Richard Stallman and the Free Software Foundation. How and why I came to use Python In 999, the College Board s Advanced Placement (AP) Computer Science exam was given in C++ for the first time. As in many high schools throughout the country, the decision to change languages had a direct impact on the computer science curriculum at Yorktown High School in Arlington, Virginia, where I teach. Up to this point, Pascal was the language of instruction in both our first-year and AP courses. In keeping with past practice of giving students two years of exposure to the same language, we made the decision to switch to C++ in the first year course for the school year so that we would be in step with the College Board s change for the AP course the following year. Two years later, I was convinced that C++ was a poor choice to use for introducing students to computer science. While it is certainly a very powerful programming language, it is also an extremely difficult language to learn and teach. I found myself constantly fighting with C++ s difficult syntax and multiple ways of doing things, and I was losing many students unnecessarily as a result. Convinced there had to be a better language choice for our first-year class, I went looking for an alternative to C++. I needed a language that would run on the machines in our GNU/Linux lab as well as on the Windows and Macintosh platforms most students have at home. I wanted it to be free software, so that students could use it at home regardless of their income. I wanted a language that was used by professional programmers, and one that had an active developer community around it. It had to support both procedural and object-oriented programming. And most importantly, it had to be easy to learn and teach. When I investigated the choices with these goals in mind, Python stood out as the best candidate for the job. I asked one of Yorktown s talented students, Matt Ahrens, to give Python a try. In two months he not only learned the language but wrote an application called pyticket that enabled our staff to report technology problems via the Web. I knew that Matt could not have finished an application of that scale in so short a time in C++, and this accomplishment, combined with Matt s positive assessment of Python, suggested that Python was the solution I was looking for. Finding a textbook Having decided to use Python in both of my introductory computer science classes the following year, the most pressing problem was the lack of an available textbook. Free documents came to the rescue. Earlier in the year, Richard Stallman had introduced me to Allen 9::0 PM]

15 Preface How to Think Like a Computer Scientist: Learning with Python Downey. Both of us had written to Richard expressing an interest in developing free educational materials. Allen had already written a first-year computer science textbook, How to Think Like a Computer Scientist. When I read this book, I knew immediately that I wanted to use it in my class. It was the clearest and most helpful computer science text I had seen. It emphasized the processes of thought involved in programming rather than the features of a particular language. Reading it immediately made me a better teacher. How to Think Like a Computer Scientist was not just an excellent book, but it had been released under the GNU public license, which meant it could be used freely and modified to meet the needs of its user. Once I decided to use Python, it occurred to me that I could translate Allen s original Java version of the book into the new language. While I would not have been able to write a textbook on my own, having Allen s book to work from made it possible for me to do so, at the same time demonstrating that the cooperative development model used so well in software could also work for educational materials. Working on this book for the last two years has been rewarding for both my students and me, and my students played a big part in the process. Since I could make instant changes whenever someone found a spelling error or difficult passage, I encouraged them to look for mistakes in the book by giving them a bonus point each time they made a suggestion that resulted in a change in the text. This had the double benefit of encouraging them to read the text more carefully and of getting the text thoroughly reviewed by its most important critics, students using it to learn computer science. For the second half of the book on object-oriented programming, I knew that someone with more real programming experience than I had would be needed to do it right. The book sat in an unfinished state for the better part of a year until the open source community once again provided the needed means for its completion. I received an from Chris Meyers expressing interest in the book. Chris is a professional programmer who started teaching a programming course last year using Python at Lane Community College in Eugene, Oregon. The prospect of teaching the course had led Chris to the book, and he started helping out with it immediately. By the end of the school year he had created a companion project on our Website at called *Python for Fun* and was working with some of my most advanced students as a master teacher, guiding them beyond where I could take them. Introducing programming with Python The process of translating and using How to Think Like a Computer Scientist for the past two years has confirmed Python s suitability for teaching beginning students. Python greatly simplifies programming examples and makes important programming ideas easier to teach. The first example from the text illustrates this point. It is the traditional hello, world program, which in the Java version of the book looks like this: class Hello { } public static void main (String[] args) { System.out.println ("Hello, world."); } in the Python version it becomes: 9::0 PM]

16 Preface How to Think Like a Computer Scientist: Learning with Python print("hello, World!") Even though this is a trivial example, the advantages of Python stand out. Yorktown s Computer Science I course has no prerequisites, so many of the students seeing this example are looking at their first program. Some of them are undoubtedly a little nervous, having heard that computer programming is difficult to learn. The Java version has always forced me to choose between two unsatisfying options: either to explain the class Hello, public static void main, String[] args, {, and }, statements and risk confusing or intimidating some of the students right at the start, or to tell them, Just don t worry about all of that stuff now; we will talk about it later, and risk the same thing. The educational objectives at this point in the course are to introduce students to the idea of a programming statement and to get them to write their first program, thereby introducing them to the programming environment. The Python program has exactly what is needed to do these things, and nothing more. Comparing the explanatory text of the program in each version of the book further illustrates what this means to the beginning student. There are seven paragraphs of explanation of Hello, world! in the Java version; in the Python version, there are only a few sentences. More importantly, the missing six paragraphs do not deal with the big ideas in computer programming but with the minutia of Java syntax. I found this same thing happening throughout the book. Whole paragraphs simply disappear from the Python version of the text because Python s much clearer syntax renders them unnecessary. Using a very high-level language like Python allows a teacher to postpone talking about low-level details of the machine until students have the background that they need to better make sense of the details. It thus creates the ability to put first things first pedagogically. One of the best examples of this is the way in which Python handles variables. In Java a variable is a name for a place that holds a value if it is a built-in type, and a reference to an object if it is not. Explaining this distinction requires a discussion of how the computer stores data. Thus, the idea of a variable is bound up with the hardware of the machine. The powerful and fundamental concept of a variable is already difficult enough for beginning students (in both computer science and algebra). Bytes and addresses do not help the matter. In Python a variable is a name that refers to a thing. This is a far more intuitive concept for beginning students and is much closer to the meaning of variable that they learned in their math courses. I had much less difficulty teaching variables this year than I did in the past, and I spent less time helping students with problems using them. Another example of how Python aids in the teaching and learning of programming is in its syntax for functions. My students have always had a great deal of difficulty understanding functions. The main problem centers around the difference between a function definition and a function call, and the related distinction between a parameter and an argument. Python comes to the rescue with syntax that is nothing short of beautiful. Function definitions begin with the keyword def, so I simply tell my students, When you define a function, begin with def, followed by the name of the function that you are defining; when you call a function, simply call (type) out its name. Parameters go with definitions; arguments go with calls. There are no return types, parameter types, or reference and value parameters to get in the way, so I am now able to teach functions in less than half the time that it previously took me, with better comprehension. Using Python improved the effectiveness of our computer science program for all students. I saw a higher general level of success and a lower level of frustration than I experienced teaching with either C++ or Java. I moved faster with better results. More students left the course with the ability to create meaningful programs and with the positive attitude toward the experience of programming that this engenders. 9::0 PM]

17 Preface How to Think Like a Computer Scientist: Learning with Python Building a community I have received from all over the globe from people using this book to learn or to teach programming. A user community has begun to emerge, and many people have been contributing to the project by sending in materials for the companion Website at With the continued growth of Python, I expect the growth in the user community to continue and accelerate. The emergence of this user community and the possibility it suggests for similar collaboration among educators have been the most exciting parts of working on this project for me. By working together, we can increase the quality of materials available for our use and save valuable time. I invite you to join our community and look forward to hearing from you. Please write to me at Jeffrey Elkner Governor s Career and Technical Academy in Arlington Arlington, Virginia How to Think Like a Computer Scientist: Learning with Python» previous next index Copyright 0, Peter Wentworth, Jeffrey Elkner, Allen B. Downey and Chris Meyers. Created using Sphinx ::0 PM]

18 The Rhodes Local Edition (RLE) (Version of October, 0) How to Think Like a Computer Scientist: Learning with Python How to Think Like a Computer Scientist: Learning with Python» previous next index The Rhodes Local Edition (RLE) (Version of October, 0) By Peter Wentworth A word of thanks... We switched from Java to Python in our introductory courses in 00. So far we think the results look positive. More time will tell. This predecessor to this book was a great starting point for us, especially because of the liberal permission to change things. Having our own in-house course notes or handouts allows us to adapt and stay fresh, rearrange, see what works, and it gives us agility. We can also ensure that every student in the course gets a copy of the handouts something that doesn t always happen if we prescribe costly textbooks. Many thanks to all the contributors and the authors for making their hard work available to the Python community and to our students. A colleague and friend, Peter Warren, once made the remark that learning introductory programming is as much about the environment as it is about the programming language. I m a big fan of IDEs (Integrated Development Environments). I want help to be integrated into my editor, as a first-class citizen, available at the press of a button. I want syntax highlighting. I want immediate syntax checking, and sensible autocompletion. I m especially keen on having a single-stepping debugger and breakpoints with code inspection built in. We re trying to build a conceptual model of program execution in the student s mind, so I find most helpful for teaching to have the call stack and variables explicitly visible, and to be able to immediately inspect the result of executing a statement. My philosophy, then, is not to look for a language to teach, but to look for a combination of IDE and language that are packaged together, and evaluated as a whole. I ve made some quite deep changes to the original book to reflect this (and various other opinionated views that I hold), and I have no doubt that more changes will follow as we bed down our course. Here are some of the key things I ve approached differently: Our local situation demands that we have a large number of service course students in an introductory course of just or weeks, and then we get another semester of teaching with those going into our mainstream program. So the book is in two parts: we ll do the first five chapters in the big get your toes wet course, and the rest of the material in a separate semester. We re using Python. It is cleaner, more object oriented, and has fewer ad-hoc irregularities than earlier versions of Python. We re using PyScripter as our IDE, on Windows. And it is hardwired into parts of these notes, with screenshots, etc. I ve dropped GASP. For graphics we start with the Turtle module. As things move along, we use PyGame for more 9:: PM]

19 The Rhodes Local Edition (RLE) (Version of October, 0) How to Think Like a Computer Scientist: Learning with Python advanced graphics. I ve introduced some event-driven programming using the turtle. I have tried to push more object-oriented notions earlier, without asking students to synthesize objects or write their own classes. So, for example, in the chapter about the turtle, we create multiple instances of turtles, talk about their attributes and state (colour, position, etc), and favour method-call style to move them around, i.e. tess.forward(00). Similarly, when we use random numbers, we avoid the hidden singleton generator in the random module we rather create an instance of a generator, and invoke methods on the instance. The ease of constructing lists and the for loop seem to be winners in Python, so rather than use the traditional command-line input for data, I ve favoured using loops and lists right up front, like this: friends = ["Amy", "Joe", "Bill"] for f in friends: invitation = "Hi " + f + ". Please come to my party on Saturday!" print(invitation) This also means that I bumped range up for early exposure. I envisage that over time we ll see more opportunities to exploit early lists, early iteration in its most simple form. I dumped doctest : it is a bit too quirky for my liking. For example, it fails a test if the spacing between list elements is not precisely the same as the output string, or if Python prints a string with single quotes, but you wrote up the test case with double quotes. Cases like this also confused students (and instructors) quite badly: 7 def addlist(xs): """ >>> xs = [,,] >>> addlist(xs) 9 """ return If you can explain the difference in scope rules and lifetimes between the parameter xs and the doctest variable xs elegantly, please let me know. Yes, I know doctest creates its own scope behind our back, but it is exactly this black magic that we re trying to avoid. From the usual indentation rules, also looks like the doctests are nested inside the function scope, but they are not. Students thought that the parameter had been given its value by the assignment to xs in the doctest! I also think that keeping the test suite separate from the functions under test leads to a cleaner relationship between caller and callee, and gives a better chance of getting argument passing / parameter concepts taught accurately. There is a good unit testing module in Python, (and PyScripter offers integrated support for it, and automated generation of skeleton test modules), but it looked too advanced for beginners, because it requires multi-module concepts. So I ve favoured my own test scaffolding in Chapter (about 0 lines of code) that the students must insert into whatever file they re working on. 9:: PM]

20 The Rhodes Local Edition (RLE) (Version of October, 0) How to Think Like a Computer Scientist: Learning with Python I ve played down command-line input / process / output where possible. Many of our students have never seen a command-line shell, and it is arguably quite intimidating. We ve gone back to a more classic / static approach to writing our own classes and objects. Python (in company with languages like Javascript, Ruby, Perl, PHP, etc.) don t really emphasize notions of sealed classes or private members, or even sealed instances. So one teaching approach is to allocate each instance as an empty container, and subsequently allow the external clients of the class to poke new members (methods or attributes) into different instances as they wish to. It is a very dynamic approach, but perhaps not one that encourages thinking in abstractions, layers, contracts, decoupling, etc. It might even be the kind of thing that one could write one of those x,y,z... considered harmful papers about. In our more conservative approach, we put an initializer into every class, we determine at object instantiation time what members we want, and we initialize the instances from within the class. So we ve moved closer in philosophy to C# / Java on this one. We re moving towards introducing more algorithms earlier into the course. Python is an efficient teaching language we can make fast progress. But the gains we make there we d like to invest into deeper problem solving, and more complex algorithms with the basics, rather than cover more Python features. Some of these changes have started to find their way in this version, and I m sure we ll see more in future. We re interested in issues around teaching and learning. Some research indicates that intellectual playfulness is important. The study referenced in the Odds-and-ends workbook at the end just didn t seem to have anywhere sensible to go in the book, yet I wanted it included. It is quite likely that we ll allow more issues like this to creep into the book, to try to make it more than just about programming in Python. How to Think Like a Computer Scientist: Learning with Python» previous next index Copyright 0, Peter Wentworth, Jeffrey Elkner, Allen B. Downey and Chris Meyers. Created using Sphinx :: PM]

How to Think Like a Computer Scientist How to Think Like a Computer Scientist: Learning with Python 2nd Edition documentation

How to Think Like a Computer Scientist How to Think Like a Computer Scientist: Learning with Python 2nd Edition documentation How to Think Like a Computer Scientist How to Think Like a Computer Scientist: Learning with Python 2nd Edition documentation next index How to Think Like a Computer Scientist: Learning with Python 2nd

More information

How to Think Like a Computer Scientist: Learning with Python Documentation

How to Think Like a Computer Scientist: Learning with Python Documentation How to Think Like a Computer Scientist: Learning with Python Documentation Jeffrey Elkner, Allen B. Downey and Chris Meyers October 21, 2015 CONTENTS 1 Learning with Python 3 1.1 Copyright Notice...................................

More information

Using Python in a High School Computer Science Program

Using Python in a High School Computer Science Program Using Python in a High School Computer Science Program Jeffrey Elkner Yorktown High School, Arlington, Virginia Abstract Yorktown High School, in Arlington Virginia, has begun a large scale experiment

More information

How to Think Like a Computer Scientist. Learning with Python

How to Think Like a Computer Scientist. Learning with Python How to Think Like a Computer Scientist Learning with Python ii How to Think Like a Computer Scientist Learning with Python Allen Downey Jeffrey Elkner Chris Meyers Green Tea Press Wellesley, Massachusetts

More information

Computer Programming. Course Details An Introduction to Computational Tools. Prof. Mauro Gaspari: mauro.gaspari@unibo.it

Computer Programming. Course Details An Introduction to Computational Tools. Prof. Mauro Gaspari: mauro.gaspari@unibo.it Computer Programming Course Details An Introduction to Computational Tools Prof. Mauro Gaspari: mauro.gaspari@unibo.it Road map for today The skills that we would like you to acquire: to think like a computer

More information

Glossary of Object Oriented Terms

Glossary of Object Oriented Terms Appendix E Glossary of Object Oriented Terms abstract class: A class primarily intended to define an instance, but can not be instantiated without additional methods. abstract data type: An abstraction

More information

Introduction to Python

Introduction to Python WEEK ONE Introduction to Python Python is such a simple language to learn that we can throw away the manual and start with an example. Traditionally, the first program to write in any programming language

More information

University of Hull Department of Computer Science. Wrestling with Python Week 01 Playing with Python

University of Hull Department of Computer Science. Wrestling with Python Week 01 Playing with Python Introduction Welcome to our Python sessions. University of Hull Department of Computer Science Wrestling with Python Week 01 Playing with Python Vsn. 1.0 Rob Miles 2013 Please follow the instructions carefully.

More information

Computer Programming I

Computer Programming I Computer Programming I COP 2210 Syllabus Spring Semester 2012 Instructor: Greg Shaw Office: ECS 313 (Engineering and Computer Science Bldg) Office Hours: Tuesday: 2:50 4:50, 7:45 8:30 Thursday: 2:50 4:50,

More information

#820 Computer Programming 1A

#820 Computer Programming 1A Computer Programming I Levels: 10-12 Units of Credit: 1.0 CIP Code: 11.0201 Core Code: 35-02-00-00-030 Prerequisites: Secondary Math I, Keyboarding Proficiency, Computer Literacy requirement Semester 1

More information

Fundamentals of Java Programming

Fundamentals of Java Programming Fundamentals of Java Programming This document is exclusive property of Cisco Systems, Inc. Permission is granted to print and copy this document for non-commercial distribution and exclusive use by instructors

More information

Moving from CS 61A Scheme to CS 61B Java

Moving from CS 61A Scheme to CS 61B Java Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you

More information

Exercise 4 Learning Python language fundamentals

Exercise 4 Learning Python language fundamentals Exercise 4 Learning Python language fundamentals Work with numbers Python can be used as a powerful calculator. Practicing math calculations in Python will help you not only perform these tasks, but also

More information

Thomas Jefferson High School for Science and Technology Program of Studies Accelerated Foundations of Computer Science as of April 2013

Thomas Jefferson High School for Science and Technology Program of Studies Accelerated Foundations of Computer Science as of April 2013 Thomas Jefferson High School for Science and Technology Program of Studies Accelerated Foundations of Computer Science as of April 2013 Unit of Study / Accelerated Foundations of Computer Science is offered

More information

Computer Programming I & II*

Computer Programming I & II* Computer Programming I & II* Career Cluster Information Technology Course Code 10152 Prerequisite(s) Computer Applications, Introduction to Information Technology Careers (recommended), Computer Hardware

More information

Programming in Access VBA

Programming in Access VBA PART I Programming in Access VBA In this part, you will learn all about how Visual Basic for Applications (VBA) works for Access 2010. A number of new VBA features have been incorporated into the 2010

More information

Python Loops and String Manipulation

Python Loops and String Manipulation WEEK TWO Python Loops and String Manipulation Last week, we showed you some basic Python programming and gave you some intriguing problems to solve. But it is hard to do anything really exciting until

More information

Domains and Competencies

Domains and Competencies Domains and Competencies DOMAIN I TECHNOLOGY APPLICATIONS CORE Standards Assessed: Computer Science 8 12 I VII Competency 001: The computer science teacher knows technology terminology and concepts; the

More information

A Note for Students: How to Use This Book

A Note for Students: How to Use This Book Preface This book is an introduction to computer science. It is intended for beginning CS majors or students from other fields who want a general introduction to computer science and computer programming.

More information

AP Computer Science A - Syllabus Overview of AP Computer Science A Computer Facilities

AP Computer Science A - Syllabus Overview of AP Computer Science A Computer Facilities AP Computer Science A - Syllabus Overview of AP Computer Science A Computer Facilities The classroom is set up like a traditional classroom on the left side of the room. This is where I will conduct my

More information

How to Think Like a Computer Scientist. Java Version

How to Think Like a Computer Scientist. Java Version How to Think Like a Computer Scientist Java Version ii How to Think Like a Computer Scientist Java Version Allen B. Downey Version 4.0 March 6, 2003 Copyright c 2003 Allen Downey. Permission is granted

More information

CS 106 Introduction to Computer Science I

CS 106 Introduction to Computer Science I CS 106 Introduction to Computer Science I 01 / 21 / 2014 Instructor: Michael Eckmann Today s Topics Introduction Homework assignment Review the syllabus Review the policies on academic dishonesty and improper

More information

CS 1133, LAB 2: FUNCTIONS AND TESTING http://www.cs.cornell.edu/courses/cs1133/2015fa/labs/lab02.pdf

CS 1133, LAB 2: FUNCTIONS AND TESTING http://www.cs.cornell.edu/courses/cs1133/2015fa/labs/lab02.pdf CS 1133, LAB 2: FUNCTIONS AND TESTING http://www.cs.cornell.edu/courses/cs1133/2015fa/labs/lab02.pdf First Name: Last Name: NetID: The purpose of this lab is to help you to better understand functions:

More information

River Dell Regional School District. Computer Programming with Python Curriculum

River Dell Regional School District. Computer Programming with Python Curriculum River Dell Regional School District Computer Programming with Python Curriculum 2015 Mr. Patrick Fletcher Superintendent River Dell Regional Schools Ms. Lorraine Brooks Principal River Dell High School

More information

COMP150: Practical Programming (in Python) Jeffrey Elkner Allen B. Downey Chris Meyers Brendan McCane Iain Hewson Nick Meek

COMP150: Practical Programming (in Python) Jeffrey Elkner Allen B. Downey Chris Meyers Brendan McCane Iain Hewson Nick Meek COMP150: Practical Programming (in Python) Jeffrey Elkner Allen B. Downey Chris Meyers Brendan McCane Iain Hewson Nick Meek June 22, 2009 ii Contents 1 The way of the program 1 1.1 The Python programming

More information

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON PROBLEM SOLVING WITH SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON Addison Wesley Boston San Francisco New York London

More information

Programming and Software Development CTAG Alignments

Programming and Software Development CTAG Alignments Programming and Software Development CTAG Alignments This document contains information about four Career-Technical Articulation Numbers (CTANs) for Programming and Software Development Career-Technical

More information

Computer Programming I

Computer Programming I Computer Programming I Levels: 10-12 Units of Credit: 1.0 CIP Code: 11.0201 Core Code: 35-02-00-00-030 Prerequisites: Secondary Math I, Keyboarding Proficiency, Computer Literacy requirement (e.g. Exploring

More information

Welcome to Introduction to Computers and Programming Course using Python

Welcome to Introduction to Computers and Programming Course using Python Welcome to Introduction to Computers and Programming Course using Python V22.0002, Section 3, Spring 2010 Course Introduction Professor: Sana Odeh odeh@courant.nyu.edu Office hours: Mondays 2:00 pm - 4

More information

Summit Public Schools Summit, New Jersey Grade Level / Content Area: Mathematics Length of Course: 1 Academic Year Curriculum: AP Computer Science A

Summit Public Schools Summit, New Jersey Grade Level / Content Area: Mathematics Length of Course: 1 Academic Year Curriculum: AP Computer Science A Summit Public Schools Summit, New Jersey Grade Level / Content Area: Mathematics Length of Course: 1 Academic Year Curriculum: AP Computer Science A Developed By Brian Weinfeld Course Description: AP Computer

More information

Charles Dierbach. Wiley

Charles Dierbach. Wiley Charles Dierbach Wiley Contents Preface Acknowledgments About the Author XXI xxv xxvii Introduction 1 MOTIVATION 2 FUNDAMENTALS 2 1.1 What Is Computer Science? 2 1.1.1 The Essence of Computational Problem

More information

Part 1 Foundations of object orientation

Part 1 Foundations of object orientation OFWJ_C01.QXD 2/3/06 2:14 pm Page 1 Part 1 Foundations of object orientation OFWJ_C01.QXD 2/3/06 2:14 pm Page 2 1 OFWJ_C01.QXD 2/3/06 2:14 pm Page 3 CHAPTER 1 Objects and classes Main concepts discussed

More information

Chapter 12 Programming Concepts and Languages

Chapter 12 Programming Concepts and Languages Chapter 12 Programming Concepts and Languages Chapter 12 Programming Concepts and Languages Paradigm Publishing, Inc. 12-1 Presentation Overview Programming Concepts Problem-Solving Techniques The Evolution

More information

Chapter 13: Program Development and Programming Languages

Chapter 13: Program Development and Programming Languages Understanding Computers Today and Tomorrow 12 th Edition Chapter 13: Program Development and Programming Languages Learning Objectives Understand the differences between structured programming, object-oriented

More information

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share. LING115 Lecture Note Session #4 Python (1) 1. Introduction As we have seen in previous sessions, we can use Linux shell commands to do simple text processing. We now know, for example, how to count words.

More information

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives Introduction to Programming and Algorithms Module 1 CS 146 Sam Houston State University Dr. Tim McGuire Module Objectives To understand: the necessity of programming, differences between hardware and software,

More information

Hypercosm. Studio. www.hypercosm.com

Hypercosm. Studio. www.hypercosm.com Hypercosm Studio www.hypercosm.com Hypercosm Studio Guide 3 Revision: November 2005 Copyright 2005 Hypercosm LLC All rights reserved. Hypercosm, OMAR, Hypercosm 3D Player, and Hypercosm Studio are trademarks

More information

The C Programming Language course syllabus associate level

The C Programming Language course syllabus associate level TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming

More information

Curriculum Map. Discipline: Computer Science Course: C++

Curriculum Map. Discipline: Computer Science Course: C++ Curriculum Map Discipline: Computer Science Course: C++ August/September: How can computer programs make problem solving easier and more efficient? In what order does a computer execute the lines of code

More information

VISUAL GUIDE to. RX Scripting. for Roulette Xtreme - System Designer 2.0

VISUAL GUIDE to. RX Scripting. for Roulette Xtreme - System Designer 2.0 VISUAL GUIDE to RX Scripting for Roulette Xtreme - System Designer 2.0 UX Software - 2009 TABLE OF CONTENTS INTRODUCTION... ii What is this book about?... iii How to use this book... iii Time to start...

More information

Exercise 1: Python Language Basics

Exercise 1: Python Language Basics Exercise 1: Python Language Basics In this exercise we will cover the basic principles of the Python language. All languages have a standard set of functionality including the ability to comment code,

More information

Basic Programming and PC Skills: Basic Programming and PC Skills:

Basic Programming and PC Skills: Basic Programming and PC Skills: Texas University Interscholastic League Contest Event: Computer Science The contest challenges high school students to gain an understanding of the significance of computation as well as the details of

More information

Python Programming: An Introduction to Computer Science

Python Programming: An Introduction to Computer Science Python Programming: An Introduction to Computer Science Chapter 1 Computers and Programs 1 Objectives To understand the respective roles of hardware and software in a computing system. To learn what computer

More information

Visual Basic. murach's TRAINING & REFERENCE

Visual Basic. murach's TRAINING & REFERENCE TRAINING & REFERENCE murach's Visual Basic 2008 Anne Boehm lbm Mike Murach & Associates, Inc. H 1-800-221-5528 (559) 440-9071 Fax: (559) 440-0963 murachbooks@murach.com www.murach.com Contents Introduction

More information

Review questions for Chapter 9

Review questions for Chapter 9 Answer first, then check at the end. Review questions for Chapter 9 True/False 1. A compiler translates a high-level language program into the corresponding program in machine code. 2. An interpreter is

More information

Objectives. Python Programming: An Introduction to Computer Science. Lab 01. What we ll learn in this class

Objectives. Python Programming: An Introduction to Computer Science. Lab 01. What we ll learn in this class Python Programming: An Introduction to Computer Science Chapter 1 Computers and Programs Objectives Introduction to the class Why we program and what that means Introduction to the Python programming language

More information

Programming Languages CIS 443

Programming Languages CIS 443 Course Objectives Programming Languages CIS 443 0.1 Lexical analysis Syntax Semantics Functional programming Variable lifetime and scoping Parameter passing Object-oriented programming Continuations Exception

More information

Computing Concepts with Java Essentials

Computing Concepts with Java Essentials 2008 AGI-Information Management Consultants May be used for personal purporses only or by libraries associated to dandelon.com network. Computing Concepts with Java Essentials 3rd Edition Cay Horstmann

More information

CSE 373: Data Structure & Algorithms Lecture 25: Programming Languages. Nicki Dell Spring 2014

CSE 373: Data Structure & Algorithms Lecture 25: Programming Languages. Nicki Dell Spring 2014 CSE 373: Data Structure & Algorithms Lecture 25: Programming Languages Nicki Dell Spring 2014 What is a Programming Language? A set of symbols and associated tools that translate (if necessary) collections

More information

Chapter 1. Dr. Chris Irwin Davis Email: cid021000@utdallas.edu Phone: (972) 883-3574 Office: ECSS 4.705. CS-4337 Organization of Programming Languages

Chapter 1. Dr. Chris Irwin Davis Email: cid021000@utdallas.edu Phone: (972) 883-3574 Office: ECSS 4.705. CS-4337 Organization of Programming Languages Chapter 1 CS-4337 Organization of Programming Languages Dr. Chris Irwin Davis Email: cid021000@utdallas.edu Phone: (972) 883-3574 Office: ECSS 4.705 Chapter 1 Topics Reasons for Studying Concepts of Programming

More information

Chapter 13: Program Development and Programming Languages

Chapter 13: Program Development and Programming Languages 15 th Edition Understanding Computers Today and Tomorrow Comprehensive Chapter 13: Program Development and Programming Languages Deborah Morley Charles S. Parker Copyright 2015 Cengage Learning Learning

More information

Using Web-based Tools to Enhance Student Learning and Practice in Data Structures Course

Using Web-based Tools to Enhance Student Learning and Practice in Data Structures Course Using Web-based Tools to Enhance Student Learning and Practice in Data Structures Course 1. Introduction Chao Chen January 2014 The purpose of this project is to enhance student learning and practice in

More information

HOUR 3 Creating Our First ASP.NET Web Page

HOUR 3 Creating Our First ASP.NET Web Page HOUR 3 Creating Our First ASP.NET Web Page In the last two hours, we ve spent quite a bit of time talking in very highlevel terms about ASP.NET Web pages and the ASP.NET programming model. We ve looked

More information

Introduction to Programming System Design. CSCI 455x (4 Units)

Introduction to Programming System Design. CSCI 455x (4 Units) Introduction to Programming System Design CSCI 455x (4 Units) Description This course covers programming in Java and C++. Topics include review of basic programming concepts such as control structures,

More information

Invitation to Ezhil : A Tamil Programming Language for Early Computer-Science Education 07/10/13

Invitation to Ezhil : A Tamil Programming Language for Early Computer-Science Education 07/10/13 Invitation to Ezhil: A Tamil Programming Language for Early Computer-Science Education Abstract: Muthiah Annamalai, Ph.D. Boston, USA. Ezhil is a Tamil programming language with support for imperative

More information

Semester Review. CSC 301, Fall 2015

Semester Review. CSC 301, Fall 2015 Semester Review CSC 301, Fall 2015 Programming Language Classes There are many different programming language classes, but four classes or paradigms stand out:! Imperative Languages! assignment and iteration!

More information

C Compiler Targeting the Java Virtual Machine

C Compiler Targeting the Java Virtual Machine C Compiler Targeting the Java Virtual Machine Jack Pien Senior Honors Thesis (Advisor: Javed A. Aslam) Dartmouth College Computer Science Technical Report PCS-TR98-334 May 30, 1998 Abstract One of the

More information

VIRTUAL LABORATORY: MULTI-STYLE CODE EDITOR

VIRTUAL LABORATORY: MULTI-STYLE CODE EDITOR VIRTUAL LABORATORY: MULTI-STYLE CODE EDITOR Andrey V.Lyamin, State University of IT, Mechanics and Optics St. Petersburg, Russia Oleg E.Vashenkov, State University of IT, Mechanics and Optics, St.Petersburg,

More information

PHP Debugging. Draft: March 19, 2013 2013 Christopher Vickery

PHP Debugging. Draft: March 19, 2013 2013 Christopher Vickery PHP Debugging Draft: March 19, 2013 2013 Christopher Vickery Introduction Debugging is the art of locating errors in your code. There are three types of errors to deal with: 1. Syntax errors: When code

More information

Instructional Design Framework CSE: Unit 1 Lesson 1

Instructional Design Framework CSE: Unit 1 Lesson 1 Instructional Design Framework Stage 1 Stage 2 Stage 3 If the desired end result is for learners to then you need evidence of the learners ability to then the learning events need to. Stage 1 Desired Results

More information

JavaScript: Introduction to Scripting. 2008 Pearson Education, Inc. All rights reserved.

JavaScript: Introduction to Scripting. 2008 Pearson Education, Inc. All rights reserved. 1 6 JavaScript: Introduction to Scripting 2 Comment is free, but facts are sacred. C. P. Scott The creditor hath a better memory than the debtor. James Howell When faced with a decision, I always ask,

More information

Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation

Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science updated 03/08/2012 Unit 1: JKarel 8 weeks http://www.fcps.edu/is/pos/documents/hs/compsci.htm

More information

C++ INTERVIEW QUESTIONS

C++ INTERVIEW QUESTIONS C++ INTERVIEW QUESTIONS http://www.tutorialspoint.com/cplusplus/cpp_interview_questions.htm Copyright tutorialspoint.com Dear readers, these C++ Interview Questions have been designed specially to get

More information

RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE. CISY 105 Foundations of Computer Science

RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE. CISY 105 Foundations of Computer Science I. Basic Course Information RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE CISY 105 Foundations of Computer Science A. Course Number and Title: CISY-105, Foundations of Computer Science B. New

More information

Language Evaluation Criteria. Evaluation Criteria: Readability. Evaluation Criteria: Writability. ICOM 4036 Programming Languages

Language Evaluation Criteria. Evaluation Criteria: Readability. Evaluation Criteria: Writability. ICOM 4036 Programming Languages ICOM 4036 Programming Languages Preliminaries Dr. Amirhossein Chinaei Dept. of Electrical & Computer Engineering UPRM Spring 2010 Language Evaluation Criteria Readability: the ease with which programs

More information

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection

More information

Programming Languages

Programming Languages Programming Languages Qing Yi Course web site: www.cs.utsa.edu/~qingyi/cs3723 cs3723 1 A little about myself Qing Yi Ph.D. Rice University, USA. Assistant Professor, Department of Computer Science Office:

More information

CS 40 Computing for the Web

CS 40 Computing for the Web CS 40 Computing for the Web Art Lee January 20, 2015 Announcements Course web on Sakai Homework assignments submit them on Sakai Email me the survey: See the Announcements page on the course web for instructions

More information

Java (12 Weeks) Introduction to Java Programming Language

Java (12 Weeks) Introduction to Java Programming Language Java (12 Weeks) Topic Lecture No. Introduction to Java Programming Language 1 An Introduction to Java o Java as a Programming Platform, The Java "White Paper" Buzzwords, Java and the Internet, A Short

More information

Computers. An Introduction to Programming with Python. Programming Languages. Programs and Programming. CCHSG Visit June 2014. Dr.-Ing.

Computers. An Introduction to Programming with Python. Programming Languages. Programs and Programming. CCHSG Visit June 2014. Dr.-Ing. Computers An Introduction to Programming with Python CCHSG Visit June 2014 Dr.-Ing. Norbert Völker Many computing devices are embedded Can you think of computers/ computing devices you may have in your

More information

Semantic Analysis: Types and Type Checking

Semantic Analysis: Types and Type Checking Semantic Analysis Semantic Analysis: Types and Type Checking CS 471 October 10, 2007 Source code Lexical Analysis tokens Syntactic Analysis AST Semantic Analysis AST Intermediate Code Gen lexical errors

More information

Intro to scientific programming (with Python) Pietro Berkes, Brandeis University

Intro to scientific programming (with Python) Pietro Berkes, Brandeis University Intro to scientific programming (with Python) Pietro Berkes, Brandeis University Next 4 lessons: Outline Scientific programming: best practices Classical learning (Hoepfield network) Probabilistic learning

More information

Think Python. Wikibooks.org

Think Python. Wikibooks.org Think Python Wikibooks.org March 16, 2013 On the 28th of April 2012 the contents of the English as well as German Wikibooks and Wikipedia projects were licensed under Creative Commons Attribution-ShareAlike

More information

[Refer Slide Time: 05:10]

[Refer Slide Time: 05:10] Principles of Programming Languages Prof: S. Arun Kumar Department of Computer Science and Engineering Indian Institute of Technology Delhi Lecture no 7 Lecture Title: Syntactic Classes Welcome to lecture

More information

1/20/2016 INTRODUCTION

1/20/2016 INTRODUCTION INTRODUCTION 1 Programming languages have common concepts that are seen in all languages This course will discuss and illustrate these common concepts: Syntax Names Types Semantics Memory Management We

More information

Think Java. How to Think Like a Computer Scientist. Allen B. Downey 5.1.2

Think Java. How to Think Like a Computer Scientist. Allen B. Downey 5.1.2 Think Java How to Think Like a Computer Scientist Allen B. Downey 5.1.2 Copyright 2012 Allen Downey. Permission is granted to copy, distribute, transmit and adapt this work under a Creative Commons Attribution-NonCommercial-ShareAlike

More information

Python Lists and Loops

Python Lists and Loops WEEK THREE Python Lists and Loops You ve made it to Week 3, well done! Most programs need to keep track of a list (or collection) of things (e.g. names) at one time or another, and this week we ll show

More information

CS 2112 Spring 2014. 0 Instructions. Assignment 3 Data Structures and Web Filtering. 0.1 Grading. 0.2 Partners. 0.3 Restrictions

CS 2112 Spring 2014. 0 Instructions. Assignment 3 Data Structures and Web Filtering. 0.1 Grading. 0.2 Partners. 0.3 Restrictions CS 2112 Spring 2014 Assignment 3 Data Structures and Web Filtering Due: March 4, 2014 11:59 PM Implementing spam blacklists and web filters requires matching candidate domain names and URLs very rapidly

More information

The Clean programming language. Group 25, Jingui Li, Daren Tuzi

The Clean programming language. Group 25, Jingui Li, Daren Tuzi The Clean programming language Group 25, Jingui Li, Daren Tuzi The Clean programming language Overview The Clean programming language first appeared in 1987 and is still being further developed. It was

More information

6.170 Tutorial 3 - Ruby Basics

6.170 Tutorial 3 - Ruby Basics 6.170 Tutorial 3 - Ruby Basics Prerequisites 1. Have Ruby installed on your computer a. If you use Mac/Linux, Ruby should already be preinstalled on your machine. b. If you have a Windows Machine, you

More information

The Rules 1. One level of indentation per method 2. Don t use the ELSE keyword 3. Wrap all primitives and Strings

The Rules 1. One level of indentation per method 2. Don t use the ELSE keyword 3. Wrap all primitives and Strings Object Calisthenics 9 steps to better software design today, by Jeff Bay http://www.xpteam.com/jeff/writings/objectcalisthenics.rtf http://www.pragprog.com/titles/twa/thoughtworks-anthology We ve all seen

More information

AP Computer Science Java Subset

AP Computer Science Java Subset APPENDIX A AP Computer Science Java Subset The AP Java subset is intended to outline the features of Java that may appear on the AP Computer Science A Exam. The AP Java subset is NOT intended as an overall

More information

Outline. hardware components programming environments. installing Python executing Python code. decimal and binary notations running Sage

Outline. hardware components programming environments. installing Python executing Python code. decimal and binary notations running Sage Outline 1 Computer Architecture hardware components programming environments 2 Getting Started with Python installing Python executing Python code 3 Number Systems decimal and binary notations running

More information

Introduction to the course, Eclipse and Python

Introduction to the course, Eclipse and Python As you arrive: 1. Start up your computer and plug it in. 2. Log into Angel and go to CSSE 120. Do the Attendance Widget the PIN is on the board. 3. Go to the Course Schedule web page. Open the Slides for

More information

Introduction to Programming

Introduction to Programming Introduction to Programming If you re new to programming, you might be intimidated by code and flowcharts. You might even wonder how you ll ever understand them. This lesson offers some basic ideas and

More information

Chapter 5 Names, Bindings, Type Checking, and Scopes

Chapter 5 Names, Bindings, Type Checking, and Scopes Chapter 5 Names, Bindings, Type Checking, and Scopes Chapter 5 Topics Introduction Names Variables The Concept of Binding Type Checking Strong Typing Scope Scope and Lifetime Referencing Environments Named

More information

Software Engineering Techniques

Software Engineering Techniques Software Engineering Techniques Low level design issues for programming-in-the-large. Software Quality Design by contract Pre- and post conditions Class invariants Ten do Ten do nots Another type of summary

More information

Getting Started with the Internet Communications Engine

Getting Started with the Internet Communications Engine Getting Started with the Internet Communications Engine David Vriezen April 7, 2014 Contents 1 Introduction 2 2 About Ice 2 2.1 Proxies................................. 2 3 Setting Up ICE 2 4 Slices 2

More information

02-201: Programming for Scientists

02-201: Programming for Scientists 1. Course Information 1.1 Course description 02-201: Programming for Scientists Carl Kingsford Fall 2015 Provides a practical introduction to programming for students with little or no prior programming

More information

Java Application Developer Certificate Program Competencies

Java Application Developer Certificate Program Competencies Java Application Developer Certificate Program Competencies After completing the following units, you will be able to: Basic Programming Logic Explain the steps involved in the program development cycle

More information

Java 6 'th. Concepts INTERNATIONAL STUDENT VERSION. edition

Java 6 'th. Concepts INTERNATIONAL STUDENT VERSION. edition Java 6 'th edition Concepts INTERNATIONAL STUDENT VERSION CONTENTS PREFACE vii SPECIAL FEATURES xxviii chapter i INTRODUCTION 1 1.1 What Is Programming? 2 J.2 The Anatomy of a Computer 3 1.3 Translating

More information

Microsoft Access is an outstanding environment for both database users and professional. Introduction to Microsoft Access and Programming SESSION

Microsoft Access is an outstanding environment for both database users and professional. Introduction to Microsoft Access and Programming SESSION 539752 ch01.qxd 9/9/03 11:38 PM Page 5 SESSION 1 Introduction to Microsoft Access and Programming Session Checklist Understanding what programming is Using the Visual Basic language Programming for the

More information

The Elective Part of the NSS ICT Curriculum D. Software Development

The Elective Part of the NSS ICT Curriculum D. Software Development of the NSS ICT Curriculum D. Software Development Mr. CHEUNG Wah-sang / Mr. WONG Wing-hong, Robert Member of CDC HKEAA Committee on ICT (Senior Secondary) 1 D. Software Development The concepts / skills

More information

Fall 2012 Q530. Programming for Cognitive Science

Fall 2012 Q530. Programming for Cognitive Science Fall 2012 Q530 Programming for Cognitive Science Aimed at little or no programming experience. Improve your confidence and skills at: Writing code. Reading code. Understand the abilities and limitations

More information

Parrot in a Nutshell. Dan Sugalski dan@sidhe.org. Parrot in a nutshell 1

Parrot in a Nutshell. Dan Sugalski dan@sidhe.org. Parrot in a nutshell 1 Parrot in a Nutshell Dan Sugalski dan@sidhe.org Parrot in a nutshell 1 What is Parrot The interpreter for perl 6 A multi-language virtual machine An April Fools joke gotten out of hand Parrot in a nutshell

More information

Organization of Programming Languages CS320/520N. Lecture 05. Razvan C. Bunescu School of Electrical Engineering and Computer Science bunescu@ohio.

Organization of Programming Languages CS320/520N. Lecture 05. Razvan C. Bunescu School of Electrical Engineering and Computer Science bunescu@ohio. Organization of Programming Languages CS320/520N Razvan C. Bunescu School of Electrical Engineering and Computer Science bunescu@ohio.edu Names, Bindings, and Scopes A name is a symbolic identifier used

More information

Course MS10975A Introduction to Programming. Length: 5 Days

Course MS10975A Introduction to Programming. Length: 5 Days 3 Riverchase Office Plaza Hoover, Alabama 35244 Phone: 205.989.4944 Fax: 855.317.2187 E-Mail: rwhitney@discoveritt.com Web: www.discoveritt.com Course MS10975A Introduction to Programming Length: 5 Days

More information

AppendixA1A1. Java Language Coding Guidelines. A1.1 Introduction

AppendixA1A1. Java Language Coding Guidelines. A1.1 Introduction AppendixA1A1 Java Language Coding Guidelines A1.1 Introduction This coding style guide is a simplified version of one that has been used with good success both in industrial practice and for college courses.

More information

EMC Publishing. Ontario Curriculum Computer and Information Science Grade 11

EMC Publishing. Ontario Curriculum Computer and Information Science Grade 11 EMC Publishing Ontario Curriculum Computer and Information Science Grade 11 Correlations for: An Introduction to Programming Using Microsoft Visual Basic 2005 Theory and Foundation Overall Expectations

More information

The BSN Hardware and Software Platform: Enabling Easy Development of Body Sensor Network Applications

The BSN Hardware and Software Platform: Enabling Easy Development of Body Sensor Network Applications The BSN Hardware and Software Platform: Enabling Easy Development of Body Sensor Network Applications Joshua Ellul jellul@imperial.ac.uk Overview Brief introduction to Body Sensor Networks BSN Hardware

More information