introduction to python part 2 input and output csc482 introduction to text analytics thomas tiahrt,...

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

Upload: violet-carroll

Post on 23-Dec-2015

236 views

Category:

Documents


3 download

TRANSCRIPT

  • Slide 1
  • Slide 2
  • INTRODUCTION TO PYTHON PART 2 INPUT AND OUTPUT CSC482 Introduction to Text Analytics Thomas Tiahrt, MA, PhD
  • Slide 3
  • Input and Output
  • Slide 4
  • 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
  • Slide 5
  • Python Exercise Part 1a
  • Slide 6
  • Python Exercise Part 1b
  • Slide 7
  • 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
  • Slide 8