INTRODUCTION TO PYTHON PART 2 INPUT AND OUTPUT CSC482 Introduction to Text Analytics Thomas Tiahrt, MA, PhD.

Slides:



Advertisements
Similar presentations
CS107 Introduction to Computer Science Lecture 3, 4 An Introduction to Algorithms: Loops.
Advertisements

ME1107 Computing Y Yan
CS 106 Introduction to Computer Science I 01 / 29 / 2008 Instructor: Michael Eckmann.
Copyright 2006 by Pearson Education 1 Building Java Programs Chapter 2: Primitive Data and Definite Loops.
1 September 6, 2005CS150 Introduction to Computer Science I What Actions Do We Have Part 1 CS150 Introduction to Computer Science I.
INTRODUCTION TO PYTHON PART 4 – TEXT AND FILE PROCESSING CSC482 Introduction to Text Analytics Thomas Tiahrt, MA, PhD.
Computing Theory: BBC Basic Coding Year 11. Lesson Objective You will: Be able to define what BBC basic is Be able to annotate BBC basic code Be able.
INTRODUCTION TO PYTHON PART 3 - LOOPS AND CONDITIONAL LOGIC CSC482 Introduction to Text Analytics Thomas Tiahrt, MA, PhD.
INTRODUCTION TO PYTHON PART 5 - GRAPHICS CSC482 Introduction to Text Analytics Thomas Tiahrt, MA, PhD.
INTRODUCTION TO PYTHON PART 1 CSC482 Introduction to Text Analytics Thomas Tiahrt, MA, PhD.
Programming is instructing a computer to perform a task for you with the help of a programming language.
1 Introduction to Programming with Python. 2 Some influential ones: FORTRAN science / engineering COBOL business data LISP logic and AI BASIC a simple.
Python.
Python File Handling. In all the programs you have made so far when program is closed all the data is lost, but what if you want to keep the data to use.
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
Python Programming Using Variables and input. Objectives We’re learning to build functions and to use inputs and outputs. Outcomes Build a function Use.
Introduction to Quadratic Equations & Solving by Finding Square Roots Chapter 5.3.
Do Now : Evaluate when x = 6, y = -2 and z = The Quadratic Formula and the Discriminant Objectives Students will be able to: 1)Solve quadratic.
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 1 Simple Python Programs Using Print, Variables, Input.
COSC 235: Programming and Problem Solving Ch. 2: Your first programs!!! Instructor: Dr. X.
CSC1030 HANDS-ON INTRODUCTION TO JAVA Introductory Lab.
CS 240 – Computer Programming I Lab Kalpa Gunaratna –
CSC 1010 Programming for All Lecture 3 Useful Python Elements for Designing Programs Some material based on material from Marty Stepp, Instructor, University.
Introduction to Programming with Python
1 Introduction to Programming with Python: overview.
1 Building Java Programs Chapter 2: Primitive Data and Definite Loops.
Data Types and Conversions, Input from the Keyboard If you can't write it down in English, you can't code it. -- Peter Halpern If you lie to the computer,
Midterm Exam Topics (Prof. Chang's section) CMSC 201.
Python programming Introduction to the JES environment and basics of Python.
For Loop GCSE Computer Science – Python. For Loop The for loop iterates over the items in a sequence, which can be a string or a list (we will discuss.
CPSC 233 Tutorial January 21 st /22 nd, Linux Commands.
Introduction to Python Lesson 2a Print and Types.
Agenda Introduction Computer Programs Python Variables Assignment
Input and Output Upsorn Praphamontripong CS 1110
Introduction to Algorithms
1-1 Logic and Syntax A computer program is a solution to a problem.
Web Design II Flat Rock Community Schools
Learning Intention Learning Intention: To develop understanding of variables, data types, and comments in text based programming languages Context: Sequencing.
Lesson 1 An Introduction
Solving Quadratic Equations by the Complete the Square Method
Introduction to the JES environment and basics of Python
Design & Technology Grade 7 Python
Think What will be the output?
Variables, Expressions, and IO
CSc 110, Autumn 2017 Lecture 5: The for Loop and user input
SSEA Computer Science: CS106A
CS149D Elements of Computer Science
CSc 110, Spring 2017 Lecture 8: input; if/else
the square root principal and completing the square
Use proper case (ie Caps for the beginnings of words)
Introduction to C++ Programming
Programming Right from the Start with Visual Basic .NET 1/e
CSc 110, Autumn 2016 Lecture 9: input; if/else
Hello World! Syntax.
CSc 110, Spring 2018 Lecture 5: The for Loop and user input
Introduction to programming with Python
Variables variable: A piece of the computer's memory that is given a name and type, and can store a value. Like preset stations on a car stereo, or cell.
Variables variable: A piece of the computer's memory that is given a name and type, and can store a value. Like preset stations on a car stereo, or cell.
CSc 110, Spring 2018 Lecture 5: Loop Figures and Constants
Introduction to Programming with Python
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
Python Basics with Jupyter Notebook
CSCI N207 Data Analysis Using Spreadsheet
Introduction to Python
Lesson 02: Introduction to Python
Title Introduction: Discussion & Conclusion: Methods & Results:
Introduction to Programming with Python
The Python interpreter
What you need to do… Drag the pieces of code into the correct order like you can see in the EXAMPLE below. print ( “ int input ) = + Hello world chr ord.
Introduction to Python
Presentation transcript:

INTRODUCTION TO PYTHON PART 2 INPUT AND OUTPUT CSC482 Introduction to Text Analytics Thomas Tiahrt, MA, PhD

Input and Output

 variable: A named piece of memory that can store a value.  Usage: Compute an expression's result, store that result into a variable, and use that variable later in the program.  assignment statement: Stores a value into a variable.  Syntax: name = value  Examples: x = 5gpa = 3.14 x 5 gpa 3.14  A variable that has been given a value can be used in expressions. x + 4 is 9  Exercise: Evaluate the quadratic equation for a given a, b, and c. Variables

Python Exercise Part 1a

Python Exercise Part 1b

 Exercise: Evaluate the quadratic equation for given values of a, b, and c using Python.  Create Python code that takes the three values of a, b and c, and then compute the value of x.  Note that not all values will work properly.  A square root can be computed using x**.5 Python Exercise Part 1c

Print Command  print : Produces text output on the console.  Syntax: print " Message " print Expression  Prints the given text message or expression value on the console, and moves the cursor down to the next line. print Item1, Item2,..., ItemN  Prints several messages and/or expressions on the same line.  Examples: print "Hello, world!" age = 45 print "You have", 65 - age, "years until retirement" Output: Hello, world! You have 20 years until retirement

 input : Reads a number from user input.  You can assign (store) the result of input into a variable.  Example: age = input("How old are you? ") print "Your age is", age print "You have", 65 - age, "years until retirement" Output: How old are you? 53 Your age is 53 You have 12 years until retirement Input Command

Conclusion of Python Intro Part Two  The end has come.