1 Computing for Engineers in Python Autumn
2 Welcome! You are about to take a new programming course in Python This is the first run ever of this course The idea is to enable you to use programming as a tool to solve “real world” problems Hard work is required!
3 Course Objectives Develop basic computing skills (programming, algorithms, applications)
4 Administration Instructor: Assaf Zaritksy assafzar AT tau.post.ac.il Office hours: by e-appointement (also TAs) Shenkar building 405a Teaching Assistants: Noga Levy, Yoav Ram Web via Moodle: Everything is there! Course material (lectures, practical sessions, hw, code examples from the site: ), forum, homework submission and grading Your responsibility to be updated!
5 Practical Sessions In a standard classroom Purposes: Practice topics that were presented in class “Preparations” for next week’s class Background for homework assignments Learn practical tools Lectures will be harder to understand, and it is ok…
6 Homework 1 N = assignments Some assignments will contain a set of short technical tasks, the rest will be “interesting” Each assignment is worth 1-3 points of the final grade for a total of points Each assignment is graded to one of four grades (0,60,80,100), no bargaining! In order to pass the course you must pass the final exam and at least N-2 assignments
7 Homework 2 Submission in singles via Moodle It is allowed (and encouraged) to talk, share ideas, and help friends. No code-sharing! TAs will answer hw-related questions in the forum (make sure no one have asked the same question before) Staff s are to be used only for personal matters No code in the forum! Do not send code to the staff! We try to answers s within 48 hours
8 Homework 3 Each student has 5 grace days for late submission throughout this course If you submit late for a valid reason, attach a “late submission” note with your submission – no need to mail anyone! Approach the grader directly with homework submission/grading problems Miluim, long illness periods – you decide whether to get a PTOR or submit late
9 A Personal Note on HW It will take you a lot of time and frustration It is an engineering difficulty: figuring out what's wrong with a system and how to fix it You're engineers: make it work! There is no other way to learn how to program Believe me…
10 Exam Exam on 27.2 (Moed B on 4.4) Final grade is composed out of homework and final exam You must pass the exam to pass the course Written exam No references Includes all course material: class, practical sessions and hw
11 Working Environment Lab 008 Home versus labs VS.
12 Syllabus Tentative, not in order, probably too ambitious Python programming basics Using packages Recursion Sort & search algorithms, runtime analysis Dynamic programming Error handling Input/output Graphical user interface (GUI) Simulation Optimization Data analysis Control Signal processing
13 Resources Course slides and pointers to relevant bibliography Many Python references, but many of them are in fact manuals for the language Recommended book and manual: Think Python, by Allen B. Downey, which is available online (basic) Python 2.7 documentation, is the official language manual, and a very useful resourcehttp://docs.python.org/ Dive Into Python by Mark Pilgrim, available online (more advanced)
14 Questions?
15 Preface We assume no prior knowledge in programming However, we advance fast The only way to keep on track is to practice, a lot!
16 Plan for Upcoming Weeks Week 1: quick overview of Python, in a more “organized” manner in tirgul Week 2: more basics (class + tirgul) Week 3: simulation (class), more basics (tirgul)
17 Today Basic terms Python basics: learn by examples Variables Lists Strings Functions Branching (if) Loops
18 Computer מכונה המעבדת נתונים על פי רצף פקודות נתון מראש מחשב = חומרה + תכנה מעבדאמצעי פלט אמצעי קלט זכרון (עכבר, מקלדת, דיסק קשיח) (מדפסת, מסך, דיסק קשיח)
19 Algorithm סדרת פעולות סופית לביצוע משימה מסויימת Algorithm InputOutput
20 Machine Code (Language) Computers understand only machine language Basically looks like a sequence of 1’s and 0’s Very inconvenient to work with and non intuitive All other computer languages were created for human convenience The computer does not understand C/C#/Java/Scala Must be “translated” into machine language
21 Programming Languages Basics A computer program is a sequence of instructions (texts) that can be “understood" by a computer and executed by it A programming language is a machine-readable artificial language designed to express computations that can be performed by a computer
22 There are Many Programming Languages Over 500 different computer languages are listed by Wikipedia
23 Language Selection Goal Runtime vs. Development time Operating systems Platforms
24 Python Python is a general-purpose, high-level programming language Conceived in the late 1980’s by Guido van Rossum at CWI in the Netherlands Numerous users in many domains Used as a first programming language in many universities (MIT, TAU CS) the origin of the name is based on the television series Monty Python's Flying Circus
25 Last Note Before Starting We Start “Stolen” from Benny Chor’s slides
26 Hello World!
27 Hands On
28 Functions Spaces / indentation!! What are functions good for?
29 Passing Arguments to Functions
30 If/Else
31 Formal Definition
32 Logical Operators
33 Python is Lazy…
34 Handling Mistakes Understanding interpreter’s messages (see previous examples) It will take you some time to gain experience…
35 String Type
36 Strings Structure
37 Strings Built In Methods
38 How Would I Know? Built-in help (not very clear at all times) Python documentation Your favorite search engine The course’s forum
39 Lecture 1: Highlights Basic terms Functions Control structures (if/else) Strings