PhD, Senior Lecturer, Baimuratov Olimzhon A LGORITHMS & P ROGRAMMING (P YTHON ) Lecture 1 From SDU:

Slides:



Advertisements
Similar presentations
compilers and interpreters
Advertisements

CHAPTER 2 GC101 Program’s algorithm 1. COMMUNICATING WITH A COMPUTER  Programming languages bridge the gap between human thought processes and computer.
Creating a Program In today’s lesson we will look at: what programming is different types of programs how we create a program installing an IDE to get.
Python Programming Chapter 1: The way of the program Saad Bani Mohammad Department of Computer Science Al al-Bayt University 1 st 2011/2012.
Chapter 2: Algorithm Discovery and Design
Chapter 16 Programming and Languages: Telling the Computer What to Do.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
Introduction to a Programming Environment
Compilers and Interpreters. Translation to machine language Every high level language needs to be translated to machine code There are different ways.
Chapter 2: Algorithm Discovery and Design
Chapter 2: Algorithm Discovery and Design
PRE-PROGRAMMING PHASE
Programming. Software is made by programmers Computers need all kinds of software, from operating systems to applications People learn how to tell the.
Introduction to Programming (in C++) Introduction Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC.
C++ Crash Course Class 1 What is programming?. What’s this course about? Goal: Be able to design, write and run simple programs in C++ on a UNIX machine.
CS190/295 Programming in Python for Life Sciences: Lecture 1 Instructor: Xiaohui Xie University of California, Irvine.
Introduction to Programming G50PRO University of Nottingham Unit 1 : Introduction Paul Tennent
Name: Md. Iqbal Hossain Roll : Computer programming  Programming is a lot of fun and extraordinarily useful. While you learn to program,
Introduction to High-Level Language Programming
PHP: Hypertext Processor Fred Durao
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
Python Mini-Course University of Oklahoma Department of Psychology Day 1 – Lesson 2 Fundamentals of Programming Languages 4/5/09 Python Mini-Course: Day.
Introducing Java.
Programming for Linguists An Introduction to Python.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
Introduction to Python
Hello World 2 What does all that mean?.
Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.
1 Computing Software. Programming Style Programs that are not documented internally, while they may do what is requested, can be difficult to understand.
Chapter 2: Algorithm Discovery and Design Invitation to Computer Science, C++ Version, Third Edition.
Invitation to Computer Science, Java Version, Second Edition.
PYTHON. Python is a high-level, interpreted, interactive and object- oriented scripting language. Python was designed to be highly readable which uses.
Programming in Python Part I Dr. Fatma Cemile Serçe Atılım University
TMF1013 : Introduction To Computing Lecture 1 : Fundamental of Computer ComputerFoudamentals.
PhD, Senior Lecturer, Baimuratov Olimzhon A LGORITHMS & P ROGRAMMING (P YTHON ) Lecture 2 From SDU:
Computer Programming TCP1224 Chapter 3 Completing the Problem-Solving Process and Getting Started with C++
Python – Part 1 Python Programming Language 1. What is Python? High-level language Interpreted – easy to test and use interactively Object-oriented Open-source.
INLS 560 – P ROGRAMMING FOR I NFORMATION P ROFESSIONALS Instructor: Jason Carter.
Week 1 - Friday.  What did we talk about last time?  Our first Java program.
Python From the book “Think Python”
Linux Operations and Administration
Guide to Programming with Python Chapter One Getting Started: The Game Over Program.
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
IXA 1234 : C++ PROGRAMMING CHAPTER 1. PROGRAMMING LANGUAGE Programming language is a computer program that can solve certain problem / task Keyword: Computer.
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
PROGRAMMING In. Objectives  We’re learning to develop basic code with the use of the correct syntax and variables. Outcomes  Explain what syntax is.
© 2004 Pearson Addison-Wesley. All rights reserved ComS 207: Programming I Instructor: Alexander Stoytchev
Introduction to Python Lesson 1 First Program. Learning Outcomes In this lesson the student will: 1.Learn some important facts about PC’s 2.Learn how.
Software Development. Software Development Loop Design  Programmers need a solid foundation before they start coding anything  Understand the task.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
Programming Errors. Errors of different types Syntax errors – easiest to fix, found by compiler or interpreter Semantic errors – logic errors, found by.
Introduction Mehdi Einali Advanced Programming in Java 1.
The single most important skill for a computer programmer is problem solving Problem solving means the ability to formulate problems, think creatively.
Chapter 2: Algorithm Discovery and Design Invitation to Computer Science.
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
Programming In Python. Starter Using the internet… Find what a programming language is.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
Software Engineering Algorithms, Compilers, & Lifecycle.
PROBLEM SOLVING WARM-UP Fill in the spaces using any operation to solve the following (!, (), -/+,÷,×): = 6.
CHAPTER 2 GC101 Program’s algorithm 1. COMMUNICATING WITH A COMPUTER  Programming languages bridge the gap between human thought processes and computer.
Development Environment
Topic: Programming Languages and their Evolution + Intro to Scratch
CS 240 – Lecture 11 Pseudocode.
CS190/295 Programming in Python for Life Sciences: Lecture 1
PROGRAMMING FUNDAMENTALS Lecture # 03. Programming Language A Programming language used to write computer programs. Its mean of communication between.
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
Dasar-Dasar Pemrograman 2: Java Basics
Week 1 - Friday COMP 1600.
Presentation transcript:

PhD, Senior Lecturer, Baimuratov Olimzhon A LGORITHMS & P ROGRAMMING (P YTHON ) Lecture 1 From SDU: / BOOK: How to Think Like a Computer Scientist, Learning with Python Autors: Allen Downey, Jeffrey Elkner, Chris Meyers

C ONTENTS  Gradation Policy  Motivation  High / low level languages  Interpreters / compilers  Program  Debugging  First program  Install python 2

G RADATION P OLICY  Attendance - 10% (4% lectures, 6% practice)  Quizzes- 20%  Tasks - 20%  Midterm - 20%  Final - 30%  Marks distribution: First 30% includes: 2 quizzes (10%), midterm (20%) Second 30% includes: 2 quizzes (10%), tasks (20%) Final 40% includes: Final exam (30%), Attendance (10%) 3

M OTIVATION  The single most important skill for a computer scientist is problem solving.  Problem solving means the ability to formulate problems, think creatively about solutions, and express a solution clearly and accurately.  As it turns out, the process of learning to program is an excellent opportunity to practice problem solving skills. 4

H IGH / L OW LEVEL LANGUAGES  The programming language you will be learning is Python.  Python is an example of a high-level language; other high- level languages you might have heard of are C, C++, Perl, and Java.  As you might infer from the name “high-level language,” there are also low-level languages, sometimes referred to as “machine languages” or “assembly languages.”  Loosely speaking, computers can only execute programs written in low-level languages.  Thus, programs written in a high-level language have to be processed before they can run. 5

I NTERPRETERS / C OMPILERS  Two kinds of programs process high-level languages into low-level languages: interpreters and compilers.  An interpreter reads a high-level program and executes it, meaning that it does what the program says.  It processes the program a little at a time, alternately reading lines and performing computations. 6

I NTERPRETERS / C OMPILERS  A compiler reads the program and translates it completely before the program starts running.  In this case, the high-level program is called the source code, and the translated program is called the object code or the executable.  Once a program is compiled, you can execute it repeatedly without further translation.

P YTHON  Python is considered an interpreted language because Python programs are executed by an interpreter.  There are two ways to use the interpreter: command-line mode and script mode.  In command-line mode, you type Python programs and the interpreter prints the result: $ python Python 2.7. >>> print

S CRIPT  Alternatively, you can write a program in a file and use the interpreter to execute the contents of the file. Such a file is called a script.  For example, we used a text editor to create a file named latoya.py with the following contents: print  By convention, files that contain Python programs have names that end with.py.  To execute the program, we have to tell the interpreter the name of the script: $ python l.py 2 9

W HAT IS A PROGRAM ?  A program is a sequence of instructions that specifies how to perform a computation.  The computation might be something mathematical, such as solving a system of equations or finding the roots of a polynomial, but it can also be a symbolic computation, such as searching and replacing text in a document 10

P ROGRAM CONTENTS  input: Get data from the keyboard, a file, or some other device.  output: Display data on the screen or send data to a file or other device.  math: Perform basic mathematical operations like addition and multiplication.  conditional execution: Check for certain conditions and execute the appropriate sequence of statements.  repetition: Perform some action repeatedly, usually with some variation. 11

W HAT IS DEBUGGING ?  Programming is a complex process, and because it is done by human beings, it often leads to errors. For some reasons, programming errors are called bugs and the process of tracking them down and correcting them is called debugging.  Three kinds of errors can occur in a program:  syntax errors,  runtime errors,  and semantic errors.  It is useful to distinguish between them in order to track them down more quickly. 12

S YNTAX ERRORS  Python can only execute a program if the program is syntactically correct; otherwise, the process fails and returns an error message.  Syntax refers to the structure of a program and the rules about that structure.  For example, in English, a sentence must begin with a capital letter and end with a period.  this sentence contains a syntax error.  So does this one 13

S YNTAX ERRORS  If there is a single syntax error anywhere in your program, Python will print an error message and quit, and you will not be able to run your program.  During the first few weeks of your programming career, you will probably spend a lot of time tracking down syntax errors.  As you gain experience, though, you will make fewer errors and find them faster. 14

R UNTIME ERRORS  The second type of error is a runtime error, so called because the error does not appear until you run the program.  These errors are also called exceptions because they usually indicate that something exceptional (and bad) has happened.  Runtime errors are rare in the simple programs you will see in the first few chapters, so it might be a while before you encounter one. 15

S EMANTIC ERRORS  The third type of error is the semantic error.  If there is a semantic error in your program, it will run successfully, in the sense that the computer will not generate any error messages, but it will not do the right thing.  It will do something else.  Specifically, it will do what you told it to do. 16

E XPERIMENTAL DEBUGGING  One of the most important skills you will acquire is debugging.  Although it can be frustrating, debugging is one of the most intellectually rich, challenging, and interesting parts of programming.  In some ways, debugging is like detective work. You are confronted with clues, and you have to look through the processes and events that led to the results you see. 17

F ORMAL AND NATURAL LANGUAGES  Natural languages are the languages that people speak, such as English, Spanish, and French. They were not designed by people (although people try to impose some order on them); they evolved naturally.  Formal languages are languages that are designed by people for specific applications. For example, the notation that mathematicians use is a formal language that is particularly good at denoting relationships among numbers and symbols. Chemists use a formal language to represent the chemical structure of molecules. 18

A ND MOST IMPORTANTLY : Programming languages are formal languages that have been designed to express computations. Read: Chapter

T HE FIRST PROGRAM  Traditionally, the first program written in a new language is called “Hello, World!” because all it does is display the words, “Hello, World!”  In Python, it looks like this: print "Hello, World!"  This is an example of a print statement, which doesn’t actually print anything on paper. It displays a value on the screen.  In this case, the result is the words Hello, World! 20

I NSTALL P YTHON 2.7  You can download from official site:   Or may be it is already installed on your system. (case for Unix systems) Check by writing “python” in command line  At last you can get downloaded version from me. 21

T HANK YOU