Python – Part 1 Python Programming Language 1. What is Python? High-level language Interpreted – easy to test and use interactively Object-oriented Open-source.

Slides:



Advertisements
Similar presentations
Designing a Program & the Java Programming Language
Advertisements

SYSTEM PROGRAMMING & SYSTEM ADMINISTRATION
Python Programming Chapter 1: The way of the program Saad Bani Mohammad Department of Computer Science Al al-Bayt University 1 st 2011/2012.
COSC 120 Computer Programming
16/13/2015 3:30 AM6/13/2015 3:30 AM6/13/2015 3:30 AMIntroduction to Software Development What is a computer? A computer system contains: Central Processing.
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
Chapter 1 Introduction to C Programming. 1.1 INTRODUCTION This book is about problem solving with the use of computers and the C programming language.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
Program Development and Programming Languages
Programming Logic and Design, Introductory, Fourth Edition1 Understanding Computer Components and Operations (continued) A program must be free of syntax.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Lecture Notes 8/30/05 Program Design & Intro to Algorithms.
Chapter 3 Planning Your Solution
PRE-PROGRAMMING PHASE
Programming Concepts and Languages Chapter 12 – Computers: Understanding Technology, 3 rd edition 1November
Introduction to Programming (in C++) Introduction Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC.
Your Interactive Guide to the Digital World Discovering Computers 2012.
Computer Science 101 Introduction to Programming.
PHP: Hypertext Processor Fred Durao
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
Python Mini-Course University of Oklahoma Department of Psychology Day 1 – Lesson 2 Fundamentals of Programming Languages 4/5/09 Python Mini-Course: Day.
1 Integrated Development Environment Building Your First Project (A Step-By-Step Approach)
Programming Languages: Telling the Computers What to Do Chapter 16.
Lecture Note 3: ASP Syntax.  ASP Syntax  ASP Syntax ASP Code is Browser-Independent. You cannot view the ASP source code by selecting "View source"
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming 1.
Hello World 2 What does all that mean?.
1 Computing Software. Programming Style Programs that are not documented internally, while they may do what is requested, can be difficult to understand.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 6 Value- Returning Functions and Modules.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Introduction to Computational Linguistics Programming I.
PhD, Senior Lecturer, Baimuratov Olimzhon A LGORITHMS & P ROGRAMMING (P YTHON ) Lecture 1 From SDU:
PYTHON. Python is a high-level, interpreted, interactive and object- oriented scripting language. Python was designed to be highly readable which uses.
Introduction to Programming Peggy Batchelor.
Programming in Python Part I Dr. Fatma Cemile Serçe Atılım University
Python From the book “Think Python”
Guide to Programming with Python Chapter One Getting Started: The Game Over Program.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
COMPUTER PROGRAMMING. A Typical C++ Environment Phases of C++ Programs: 1- Edit 2- Preprocess 3- Compile 4- Link 5- Load 6- Execute Loader Primary Memory.
IXA 1234 : C++ PROGRAMMING CHAPTER 1. PROGRAMMING LANGUAGE Programming language is a computer program that can solve certain problem / task Keyword: Computer.
FIRST JAVA PROGRAM. JAVA PROGRAMS Every program may consist of 1 or more classes. Syntax of a class: Each class can contain 1 or more methods. public.
Variables, Expressions and Statements
School of Computer Science & Information Technology G6DICP - Lecture 6 Errors, bugs and debugging.
CSC 1010 Programming for All Lecture 2 Introduction to Python Some material based on material from Marty Stepp, Instructor, University of Washington.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley STARTING OUT WITH Python Python First Edition by Tony Gaddis Chapter 2 Input,
Computer and Programming. Computer Basics: Outline Hardware and Memory Programs Programming Languages and Compilers.
The Hashemite University Computer Engineering Department
The single most important skill for a computer programmer is problem solving Problem solving means the ability to formulate problems, think creatively.
1. COMPUTERS AND PROGRAMS Rocky K. C. Chang September 6, 2015 (Adapted from John Zelle’s slides)
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
Alexandria University Faculty of Science Computer Science Department Introduction to Programming C++
Evolution of C and C++ n C was developed by Dennis Ritchie at Bell Labs (early 1970s) as a systems programming language n C later evolved into a general-purpose.
Programming In Python. Starter Using the internet… Find what a programming language is.
Chapter 1: Introduction to Computers and Programming.
Programming Languages Concepts Chapter 1: Programming Languages Concepts Lecture # 4.
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.
Introducing Python 3 Introduction to Python. Introduction to Python L1 Introducing Python 3 Learning Objectives Know what Python is and some of the applications.
Harvard Mark I Howard Aiken was a pioneer in computing and a creator of conceptual design for IBM in the 1940s. He envisioned an electro-mechanical computing.
Programming Logic and Design Seventh Edition Chapter 1 An Overview of Computers and Programming.
Introducing Python Introduction to Python.
Development Environment
Introduction to Python
Topics Introduction to Repetition Structures
Variables, Expressions, and IO
Algorithm and Ambiguity
Designing and Debugging Batch and Interactive COBOL Programs
Topics Introduction to Value-returning Functions: Generating Random Numbers Writing Your Own Value-Returning Functions The math Module Storing Functions.
Learning Intention I will learn about the different types of programming errors.
Presentation transcript:

Python – Part 1 Python Programming Language 1

What is Python? High-level language Interpreted – easy to test and use interactively Object-oriented Open-source software 2 Prepared by Department of Preparatory year

What is Python? Small, simple language Extensible – set of modules as tools to build on the language Familiar – features from other languages (Java, C, Perl) 3 Prepared by Department of Preparatory year

Benefits Consistency – maintained by a large organization of people Scalability – Python projects scale to very large projects Flexibility – use of libraries and programs written in other languages 4 Prepared by Department of Preparatory year

Benefits Interactive interpreter Cross-platform Easy to implement 5 Prepared by Department of Preparatory year

Resources Python: Installing Python: Python Documentation: Prepared by Department of Preparatory year

Resources Python.org's list of editors and IDEseditorsIDEs – – entEnvironments entEnvironments Think Python – kpython.html kpython.html 7 Prepared by Department of Preparatory year

Python Programs Executed by an interpreter Two ways to use interpreter – Interactive mode – Script mode 8 Prepared by Department of Preparatory year

Installing Python Python 3 is used in this course phEA phEA python-windows.html python-windows.html Prepared by Department of Preparatory year 9

InteractiveMode >>> >>> is the prompt the interpreter uses to indicate that it is ready. If you type 1 + 1, the interpreter replies 2. Prepared by Department of Preparatory year 10

Script Mode Store code in a file Use the interpreter to execute the contents of the file (called script,.py extention) 11 Prepared by Department of Preparatory year

Programs A program is a sequence of instructions that specifies how to perform a computation. – 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. 12 Prepared by Department of Preparatory year

Programs (cont…) – 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. 13 Prepared by Department of Preparatory year

Debugging Programming errors are called bugs Debugging - the process of tracking them down. Three kinds of errors: – syntax errors – runtime errors – semantic errors 14 Prepared by Department of Preparatory year

Syntax errors Occur if syntax is not correct Syntax refers to the structure of a program and the rules about that structure. (1 + 2) is legal 8) is a syntax error 15 Prepared by Department of Preparatory year

Runtime errors Error does not appear until after the program has started running Also called exceptions Rare in simple programs 16 Prepared by Department of Preparatory year

Semantic errors Program runs successfully (no error messages generated) Will not do the right thing The meaning of the program (its semantics) is wrong. Tricky to identify 17 Prepared by Department of Preparatory year

The first program Hello World program – print (‘Hello, World!’) Print statement Display on the screen: – Hello World 18 Prepared by Department of Preparatory year

Exercise Start the Python interpreter and use it as a calculator. The symbol for multiplication is *. If you run a 10 kilometer race in 43 minutes 30 seconds, what is your average time per mile? What is your average speed in miles per hour? (Hint: there are 1.61 kilometers in a mile). 19 Prepared by Department of Preparatory year

Part 1 References 20