1 / 39

Computing for Engineers in Python

Computing for Engineers in Python. Autumn 2011-12. 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!. 2.

carrollh
Télécharger la présentation

Computing for Engineers in Python

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computing for Engineers in Python Autumn 2011-12

  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! 2

  3. Course Objectives Develop basic computing skills (programming, algorithms, applications) 3

  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: http://moodle.tau.ac.il/ • Everything is there! • Course material (lectures, practical sessions, hw, code examples from the site: http://www.cs.tau.ac.il/courses/pyProg/1112a/), forum, homework submission and grading • Your responsibility to be updated! 4

  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… 5

  6. Homework 1 • N = 11-13 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 15-20 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 6

  7. Homework 2 • Submission in singles via Moodle • It is allowed (and encouraged) to talk, share ideas, and help friends. No code-sharing! • TAswill answer hw-related questions in the forum (make sure no one have asked the same question before) • Staff emails are to be used only for personal matters • No code in the forum! Do not send code to the staff! • We try to answers emails within 48 hours 7

  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 inon.python@gmail.com • Miluim, long illness periods – you decide whether to get a PTOR or submit late 8

  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… 9

  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 10

  11. VS. Working Environment • Lab 008 • Home versus labs 11

  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 12

  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, http://docs.python.org/, is the official language manual, and a very useful resource • Dive Into Python by Mark Pilgrim, available online (more advanced) 13

  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! 15

  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) 16

  17. Today • Basic terms • Python basics: learn by examples • Variables • Lists • Strings • Functions • Branching (if) • Loops 17

  18. מעבד אמצעי פלט אמצעי קלט (מדפסת, מסך, דיסק קשיח) (עכבר, מקלדת, דיסק קשיח) זכרון Computer מכונה המעבדת נתונים על פי רצף פקודות נתון מראש מחשב = חומרה + תכנה

  19. Input Output Algorithm סדרת פעולות סופית לביצוע משימה מסויימת Algorithm

  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 21

  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 24

  25. Last Note Before Starting We Start 25 “Stolen” from Benny Chor’s slides

  26. Hello World! 26

  27. Hands On 27

  28. Functions Spaces / indentation!! What are functions good for? 28

  29. Passing Arguments to Functions 29

  30. If/Else 30

  31. Formal Definition 31

  32. Logical Operators 32

  33. Python is Lazy… 33

  34. Handling Mistakes • Understanding interpreter’s messages (see previous examples) • It will take you some time to gain experience… 34

  35. String Type http://docs.python.org/tutorial/introduction.html#strings 35

  36. Strings Structure 36

  37. Strings Built In Methods http://docs.python.org/release/2.5.2/lib/string-methods.html 37

  38. How Would I Know? • Built-in help (not very clear at all times) • Python documentation http://docs.python.org/ • Your favorite search engine • The course’s forum 38

  39. Lecture 1: Highlights • Basic terms • Functions • Control structures (if/else) • Strings

More Related