Introduction to Python Dr. Bernard Chen Ph.D. University of Central Arkansas July 9 th 2012

Slides:



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

Foundations of Programming and Problem Solving Introduction.
Chapter 2 First Java Programs
Object Oriented Programming in Java George Mason University Fall 2011
Your First Java Program: HelloWorld.java
Week 1 basic Python programs, defining functions Special thanks to Scott Shawcroft, Ryan Tucker, and Paul Beck for their work on these slides. Except where.
Java Intro. A First Java Program //The Hello, World! program in Java public class Hello { public static void main(String[] args) { System.out.println("Hello,
Week 1 basic Python programs, defining functions Special thanks to Scott Shawcroft, Ryan Tucker, and Paul Beck for their work on these slides. Except where.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
Copyright © 2014 Dr. James D. Palmer; This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Chapter 1: Python Basics CSCI-UA 0002 – Introduction to Computer Programming Mr. Joel Kemp.
Ch 1. Introduction Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2012.
1 TOPIC 1 INTRODUCTION TO COMPUTER SCIENCE AND PROGRAMMING Topic 1 Introduction to Computer Science and Programming Notes adapted from Introduction to.
COMP 110: Introduction to Programming Tyler Johnson January 14, 2009 MWF 11:00AM-12:15PM Sitterson 014.
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
Python 101 Dr. Bernard Chen University of Central Arkansas IT Academic.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
Computer Science 111 Fundamentals of Programming I Overview of Programming.
1 Chapter 2 First Java Programs Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Introduction to Programming Peggy Batchelor.
Session One Introduction. Personal Introduction Role of programmers Robot Examination HUD & HID Uploading Code.
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
Programming Concept Chapter I Introduction to Java Programming.
Week 1 - Friday.  What did we talk about last time?  Our first Java program.
Python From the book “Think Python”
Clement Allen, PhD Florida A&M University SUMMER 2006.
Ch 1. A Python Q&A Session Spring Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.
Guide to Programming with Python Chapter One Getting Started: The Game Over Program.
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
4-Nov-15 Air Force Institute of Technology Electrical and Computer Engineering Object-Oriented Programming Design Topic 1: The Java Environment Maj Joel.
JAVA Practical Creating our first program 2. Source code file 3. Class file 4. Understanding the different parts of our program 5. Escape characters.
 Instructor: Dr. Jason Nichols –  Office Hours: – 9:30-10:30 M/W/F or by appointment – Business Building.
Week 1 basic Python programs, defining functions Special thanks to Scott Shawcroft, Ryan Tucker, and Paul Beck for their work on these slides. Except where.
JAVA Programming “When you are willing to make sacrifices for a great cause, you will never be alone.” Instructor: รัฐภูมิ เถื่อนถนอม
Unit 1 Basic Python programs, functions Special thanks to Roy McElmurry, John Kurkowski, Scott Shawcroft, Ryan Tucker, Paul Beck for their work. Except.
OCR Computing GCSE © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 4: Writing programs.
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.
CS7 Recitation Cem Akkaya. Outline  Homework-0 in detail  Useful links and tools  Setting up your java environment.
Ch 1. A Python Q&A Session. Why do people use Python? Software Quality Developer productivity Program portability Support Libraries Component integration.
CSC 1010 Programming for All Lecture 2 Introduction to Python Some material based on material from Marty Stepp, Instructor, University of Washington.
CSc 201 Introduction to Java George Wells Room 007, Hamilton Building
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
1/10/2008. >>> About Us Paul Beck * Third quarter TA * Computer Engineering * Ryan Tucker * Second quarter TA * Computer.
3/5/2002e-business and Information Systems1 Java Java Java Virtual Machine (JVM) Java Application Program Interface (API) HW Kernel API Application Programs.
1. COMPUTERS AND PROGRAMS Rocky K. C. Chang September 6, 2015 (Adapted from John Zelle’s slides)
Invent Your Own Computer Games with Python
Computer Science A 1. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated editor,
ITP 109 Week 2 Trina Gregory Introduction to Java.
Execution ways of program References: www. en.wikipedia.org/wiki/Integrated_development_environment  You can execute or run a simple java program with.
8/2/07. >>> About Me Scott Shawcroft * Junior * Computer Engineering * Third Quarter TA * Creative Commons Intern * Small-time Open Source Developer
Getting Started With Python Brendan Routledge
UFCFY5-30-1Multimedia Studio Coding for Interactive Media Fundamental Concepts.
CSC 241: Introduction to Computer Science I
Computer Programming Your First Java Program: HelloWorld.java.
CS210 Intermediate Computing with Data Structures (Java)
Fundamentals of Programming I Overview of Programming
CST 1101 Problem Solving Using Computers
Text by: Lambert and Osborne
Ch 1. A Python Q&A Session Bernard Chen 2007.
Chapter 2 First Java Programs
basic Python programs, defining functions
Introduction to Java Dept. Business Computing University of Winnipeg
What Is a Program? A program is like an algorithm, but describes a process that is ready or can be made ready to run on a real computer Retrieved from:
Introduction to Python
basic Python programs, defining functions
Java Intro.
Section 1 Introduction To Programming
Input and Output Python3 Beginner #3.
Computer Programming-1 CSC 111
CSC 241: Introduction to Computer Science I
Presentation transcript:

Introduction to Python Dr. Bernard Chen Ph.D. University of Central Arkansas July 9 th 2012

Why do people use Python? Software Quality: Python is designed to be readable, and hence maintainable. Developer productivity: Python code is typically 1/3 to 1/5 the size of equivalent C++ or JAVA code

What can I do with Python? System Programming GUIs Internet Scripting Database Programming Games, Images, AI, XML and more

What are Python’s Technical Strength It’s OO It’s free It’s Portable It’s Powerful It’s Easy to use It’s Easy to learn

What is the Downside of Python? Perhaps the only downside to Python is that the execution speed may not always as fast as compiled languages such as C and C++ Python is not compiled all the way down to binary machine code, it compiled to byte code instead.

Who Uses Python Today? Google and Yahoo currently use Python in Internet service IBM use Python for hardware testing Industrial Light and Magic use Python in the production of movie animation For more details, visit

Install Python Go to and download Python3.2, then select Windows x86 MSI Installer (3.2) or Windows X86-64 MSI Installer (3.2) x86 MSI Installer (3.2)Windows X86-64 MSI Installer (3.2)

Install Python Or you can search for Python, choose “Download” and then select Python 3.2 Windows x86 MSI Installer or Python 3.2 Windows X86-64 MSI InstallerPython 3.2 Windows x86 MSI InstallerPython 3.2 Windows X86-64 MSI Installer

Hello World Program Implement by three different languages In C In JAVA In Python

“Hello World” in C main() { printf("hello, world\n"); }

“Hello World” in JAVA class myfirstjavaprog { public static void main(String args[]) { System.out.println("Hello World!"); }

“Hello World” in Python print (“Hello World!!”)

Be familiar with Python >>> print ("Hello, World! ") Hello, World! >>> >>> 124 – 125 >>> 1/

Python command print – Displays data, values, and expressions The single and double quotation mark string objects, which are collections of texts surrounded by quotes. Some Python commands

Be familiar with Python >>> print ("Hello, World! ") Hello, World! >>> "hello" 'hello' >>> "world" 'world' >>> "hello"+"world" 'helloworld'

Be familiar with Python >>> "hello" * 3 'hellohellohello' >>> "hello" * 300

>>> width = 20 >>> height = 45 >>> area = width * height >>> area 900 Declare a variable and assign its value Example: Area of a rectangle

>>> a=3 >>> b=4 >>> a+1 >>> b*3 >>> b/3 >>> b/3.0 >>> b**2 >>> >>> 2.0**b What are the outputs? Why?

How do you run programs? Three different methods: 1. Interactive Coding 2. Files (such as NotePad, WordPad) 3. Integrated Development Environment (IDE)

Create and run a program in the Python IDLE From File -> New Window Type your program print ("Hello, World! ") Save your program (Give a name you like, such as test.py) Run the program (by selecting the Run Module or pressing the F5 key)

Your first Python program- hello.py # This program says hello and asks for my name. hello = 'Hello world! ' print(hello) print('What is your name?') myName = input() print('It is good to meet you, ' + myName)

hello.py executed sequentially # This program says hello and asks for my name. Any text following a # sign is a comment. Comments are not for the computer, but for you, the programmer. 1. hello = 'Hello world! ' # assign the string to a name 2. print(hello) # call the print( ) function 3. print('What is your name?') # call the print( ) function 4. myName = input() # call the input( ) function 5. print('It is good to meet you, ' + myName)