Python programming Introduction to the JES environment and basics of Python.

Slides:



Advertisements
Similar presentations
Computer Science 101 While Statement. Iteration: The While-Statement The syntax for the While- Statement is while : The syntax for the While- Statement.
Advertisements

COMPUTER PROGRAMMING Task 1 LEVEL 6 PROGRAMMING: Be able to use a text based language like Python and JavaScript & correctly use procedures and functions.
Python: Making colors and Using Loops. Review JES command area – program area Defining/using functions specifying a sequence of steps for what the function.
Introduction to Python
1 Introduction to Computers and Programming Class 3 Introduction to C Professor Avi Rosenfeld.
INTRODUCTION TO PYTHON PART 2 INPUT AND OUTPUT CSC482 Introduction to Text Analytics Thomas Tiahrt, MA, PhD.
Introduction to scripting
Python. What is Python? A programming language we can use to communicate with the computer and solve problems We give the computer instructions that it.
Guide to Programming with Python Chapter Two Basic data types, Variables, and Simple I/O: The Useless Trivia Program.
Computer Science 101 Introduction to Programming.
Variables and Functions Chapter Variables Named storage location in computer’s memory Programs may need to store data when running o Stored in.
PHP : Hypertext Preprocessor
Python Programming Fundamentals
 2004 Prentice Hall, Inc. All rights reserved. Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
WEB DESIGN AND PROGRAMMING Introduction to Javascript.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Introduction to Python
General Computer Science for Engineers CISC 106 Lecture 02 Dr. John Cavazos Computer and Information Sciences 09/03/2010.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Microsoft Office Excel Copyright © 2008 Pearson Prentice Hall. All rights reserved
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Introduction to Programming Peggy Batchelor.
Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.
Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals.
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
Documentation and Comments. What’s a comment? A comment is a simple form of documentation. Documentation is text that you the programmer write to explain.
Input, Output, and Processing
Python programming Introduction to the JES environment and basics of Python Reading: Chapters 1, 2 from “Introduction to Computing and Programming in Python”
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Computer Science 101 Introduction to Programming.
CS1315: Introduction to Media Computation Introduction to Programming.
Introduction to Programming with RAPTOR
CS 100 Introduction to Computing Introduction to JES Developed by Mark Guzdial, Georgia Institute of Technology, 2003–2004; modified by Robert H. Sloan.
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 1 Simple Python Programs Using Print, Variables, Input.
Please log on The. AN INTRODUCTION TO ‘Python is a high-level, general purpose programming language’ Python is one of the many programming languages.
Variables, Expressions and Statements
Nonvisual Arrays by Chris Brown under Prof. Susan Rodger Duke University June 2012.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Programming Fundamentals. Summary of previous lectures Programming Language Phases of C++ Environment Variables and Data Types.
 2003 Prentice Hall, Inc. All rights reserved. Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
Introduction to Matlab Patrice Koehl Department of Biological Sciences National University of Singapore
CS1315: Introduction to Media Computation Introduction to JES.
29 January 2016Birkbeck College, U. London1 Introduction to Programming Lecturer: Steve Maybank Department of Computer Science and Information Systems.
Introduction to Programming
© Peter Andreae Java Programs COMP 102 # T1 Peter Andreae Computer Science Victoria University of Wellington.
Python programming Using the JES picture functions and defining new functions.
CS1315: Introduction to Media Computation Introduction to JES.
Introduction to Python Lesson 2a Print and Types.
Development Environment
Introduction to the JES environment and basics of Python
Design & Technology Grade 7 Python
Guide To UNIX Using Linux Third Edition
Variables, Expressions, and IO
Basic operations in Matlab
Chapter 7 - JavaScript: Introduction to Scripting
Chapter 2: Introduction to Programming
Introduction to Python
Week 1 Computer Programming Year 9 – Unit 9.04
JavaScript: Introduction to Scripting
Task 1 Computer Programming LEVEL 6 PROGRAMMING:
Rocky K. C. Chang September 18, 2018 (Based on Zelle and Dierbach)
Introduction to Programming with Python
CHAPTER FOUR VARIABLES AND CONSTANTS
Introduction to Value-Returning Functions: Generating Random Numbers
JavaScript: Introduction to Scripting
Chapter 7 - JavaScript: Introduction to Scripting
Chapter 7 - JavaScript: Introduction to Scripting
Data Types Every variable has a given data type. The most common data types are: String - Text made up of numbers, letters and characters. Integer - Whole.
Chapter 7 - JavaScript: Introduction to Scripting
PYTHON - VARIABLES AND OPERATORS
Presentation transcript:

Python programming Introduction to the JES environment and basics of Python

Python The programming language we will be using is called Python – –It’s used by companies like Google, Industrial Light & Magic, Nextel, and others The kind of Python we’re using is called Jython (Java-based Python) – We’ll be using a specific tool to make Python programming easier, called JES (Jython Environment for Students). –

JES - Jython Environment for Students Program area - A simple editor for programs Command area - Interaction with Jython

>>> >>> ‘spam’ ‘spam’ >>> “spam” ‘spam’ >>> “spam and more spam” ‘spam and more spam’ >>> ‘spam’ + ‘spam’ ‘spamspam’ Python interaction through commands Anything you type in command area is evaluated and its value is displayed Example: prompt

>>> print >>> print ‘spam’ spam >>> ‘spam’ + ‘spam’ ‘spamspam’ >>> print ‘spam’ + ‘spam’ Spamspam print displays the value of an expression In many cases it makes no difference whether you use print - the result gets displayed anyway. Note: no quotes!

Command Area Editing Up/down arrows walk through command history You can edit the line at the bottom –Just put the cursor at the end of the line before hitting Return/Enter.

Variables are names for data Example: a= 3 b= -1 c = 2 x = 0 f = a*x*x + b*x + c

Variables -more examples Variables of other types newsItem = “You’ve got spam!” Variables keep their value for the duration of a program or until they get a new value through a new assignment a = 3 b = a *2 + 5 a = 0 Up to this point the value of a is still 3, but then it changes to 0

Types of data Integer num = -3 Floating point number answer = Character letter = ‘5’ String note = “lol jkjk”

Python functions Python has a lot of built-in functions for general mathematical manipulation, eg: sqrt(4) - computes the square root of 4 ord(‘A’) - computes the ASCII code for character ‘A’ (i.e., a numeric code) str(4) – produces a string corresponding to a number Example: print (-b+sqrt(b*b - 4*a*c))/2*a

Special JES-Python functions JES defines some special functions for media computation

Functions in general F(a,b) 4 ‘a’F(4, ‘a’) side-effects

Example: sqrt() sqrt(a) 4 2 side-effects

Example: showInformation() showInformation(message) message Pops up a new window displaying the message text showInformation(message): message: the message to show to the user Opens a message dialog to the user showing information

Exploring more functions The JES Functions menu has functions arranged by type - check them out! Can you find a function that inputs a number? Can you find under what category pickAFile() is listed?

Reading Chapters 1, and Sections from “Introduction to Computing and Programming in Python” (up to page 22)