1 / 28

Class 1: What this course is about

Class 1: What this course is about. Assignment. Read: Chapter 1 Do: Chapter 1 ‘workbook’ pages not finished in class You should know: How to use the command line How to create and save a file if … else while Role of indenting What is a function (e.g., print(), input() )

Download Presentation

Class 1: What this course is about

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. Class 1: What this course is about

  2. Assignment • Read: Chapter 1 • Do: Chapter 1 ‘workbook’ pages not finished in class • You should know: • How to use the command line • How to create and save a file • if … else • while • Role of indenting • What is a function (e.g., print(), input()) • What is a parameter

  3. In a nutshell (Thread 1) • This course is about writing computer programs that solve problems • First step: ‘grok’ the problem. (Look up the meaning and origin of ‘grok’.) • Second step: write the program • Third step: make sure the program correctly solves the problem

  4. In a nutshell (Thread 2) • This course is about some of the high points on the terrain of computing. For example: • What is computing? • How does the Internet work? • How do hardware and software work together? • … and more

  5. What is an algorithm? • An algorithm is an unambiguous, step-by-step procedure for solving a problem • A recipe is an example of an algorithm • An algorithm provides the design for a computer program

  6. What is a computer language? • A computer language is a way of writing down algorithms • ‘High level’ languages are readable, like natural human languages • Computer languages are precise enough to be executed by (unthinking) machines • All computer languages are fundamentally equivalent in their expressive power

  7. What is a program? • A program is a set of instructions written in a computer language • A program implements an algorithm • A program written in a high-level language may be translated into a low level language (the natural language of a computer)

  8. What is a computer? • A computer is a machine which executes programs (unlike a lawn mower) • A computer can execute any program (unlike a CD-player) • Since computers are Universal Machines, they are all fundamentally equivalent in computing power

  9. How do you write a program? • A computer can execute programs that are tools for creating programs • The programmer’s everyday tools might include: • editor • compiler • debugger • A suite of such tools is called an integrated development environment (IDE) • We are using the Python language and IDLE IDE

  10. The editor • An editor is used to write programs • Programs are written in plain text • The file containing the program in a high-level language is called the source file • A Python source file usually has the extension ‘.py’

  11. The interpreter • An interpreter translates from a high-level language to the computer’s language (instruction set) • Interpreters usually translate and execute code line by line • A source file can not be interpreted and executed unless it is syntactically (grammatically) correct

  12. The devlopment environment • We will be working in the Python integrated development environment called IDLE • IDLE contains an interactive environment in which you can write and execute instructions line by line • IDLE also contains an editor to write and store programs and a debugger to help correct programs

  13. The debugger • A debugger allows you to ‘step through’ the program, viewing the changing values • A debugger aids in finding and correcting logical errors. • (The sentence ‘Colorless green ideas sleep furiously’ is grammatically correct, but what does it mean? Look in up on the Web.)

  14. Panic abatement advice • Expect to spend lots of time • Programmer wisdom: it always takes longer than you think • Expect things to go wrong • Murphy’s law of computers: anything that can’t go wrong, will • Don’t panic: every bug has a fix

  15. Tips for success • Start every assignment early • Don’t fall behind • Ask if you don’t know • Do your own work

  16. Getting help • Use the online help system • Every TA and instructor has office hours • There are tutors available (check the course web site) • My contact info: • Barry Cohen • 3503 GITC • barry.cohen@njit.edu • Tues, Thurs 2:30-3:30

  17. Grading • Homework (6) 15% • Projects (2) 15% • Midterm 1 20% • Midterm 2 20% • Final 25% • Participation 5% • All sections have same work and tests • Course is graded on a curve

  18. Attendance • Attendance is mandatory (you are asked to sign in). Five absences will lead to withdrawal • Arriving late or leaving early counts for ½ of an absence

  19. Homework • HW assignments are approximately bi-weekly • HWs are handed in at the start of class • No late HWs will be accepted • Every HW must be in hard copy – code and output, neatly printed and stapled • Every HW must have student name and SS#, date, HW # section #

  20. Honesty • Cheating on an exam will result in failing the course • You may discuss HW problems with each other • You may not take credit for something you did not do

  21. Logging On • Linux/Unix, Mac or Windows • UCID • Password • Password problem? • Unattended Password Reset (UPR) • http://mypassword.njit.edu

  22. Introduction To Python • What is Python? • Very high level language (HLL) • Scripting language • Why use Python? • Powerful and fast • Runs everywhere • Easy to learn • Easy to read • Encourages good programming practices

  23. The Python Interpreter • Linux/Unix • Open a terminal window • Type ‘python’ or ‘idle3’ at a command prompt • Or double click icon • Windows • Go to Start > Programs > Python3 > Idle • Or double click icon • Mac • Open from terminal or double click icon

  24. Python As A Calculator • Python can perform all basic arithmetic operations • How many minutes in a year? • How many seconds since the universe began 13 billion years ago?

  25. The IDLE environment • You can use IDLE to assign values to an identifier (i.e., a name) >>> x = 5 • An IDLE session has a memory >>> x 5 >>> y = x >>> y 5 • You can the change the value assigned to an identifier >>> x = 'five' >>> x 'five'

  26. Your First Python Program • Type print(‘Hello, World!’) and then press the enter key • The Python interpreter prints ‘Hello, World!’ on the screen

  27. More about Hello, World • print() is a function • A function is a named block of code • A function hides how it works from the outside world • ‘Hello, World’ is a parameter • A parameter is ‘handed’ to a function • A parameter is in parens, after the function name • Try print () and (‘‘) • Try print (‘hello‘, ‘and goodbye‘) • Try print

  28. Our textbook • Head First Programming • This book incorporates workbook material that we will do in class • Let’s go through Chapter 1

More Related