introduction to computer programming python basics csci
play

= Introduction to Computer Programming Python Basics CSCI-UA 2 - PowerPoint PPT Presentation

Introduction to Computer Programming Python Basics CSCI-UA 2 = Introduction to Computer Programming Python Basics CSCI-UA 2 High-level programming language Python Developed in the 1990s by Guido van A general purpose, Rossum


  1. Introduction to Computer Programming Python Basics CSCI-UA 2 =

  2. 
 Introduction to Computer Programming Python Basics CSCI-UA 2 High-level programming language Python Developed in the 1990s by Guido van A general purpose, Rossum cross-platform Actively maintained and documented programming language by programmers around the world Freely available Clear syntax General purpose usage Wide range of libraries available

  3. Introduction to Computer Programming Python Basics CSCI-UA 2 Web and Internet development Python Scientific and numeric computing In Use Education Desktop GUIs Software Development

  4. Introduction to Computer Programming Python Basics CSCI-UA 2 We will be using Python 3 Python python.org/download Installation Versions available for Mac, Windows, and Linux

  5. Introduction to Computer Programming Python Basics CSCI-UA 2 We’ll be using IDLE to write, run, and Python debug our code Integrated Development Interactive mode Environment Script mode

  6. Introduction to Computer Programming Writing Programs with Input and Output CSCI-UA 2 A program is just a text file containing Writing Programs Python statements A program can have two lines of code or thousands Any plain text editor can be used Give your files the extension “.py” Python executes the file by running all the statements from top to bottom

  7. Introduction to Computer Programming Python Basics CSCI-UA 2 Input Writing Programs Processing Design Output

  8. Introduction to Computer Programming Python Basics CSCI-UA 2

  9. Introduction to Computer Programming Python Basics CSCI-UA 2 Examples: Functions print() A function is a reusable input() chunk of code Function name and arguments Parentheses essentially mean “execute this function” Some functions take no input

  10. 
 
 Introduction to Computer Programming Writing Programs with Input and Output CSCI-UA 2 One of the most common built-in Functions functions we will use print() Important in our standalone Python programs for providing output Additional arguments to the print function include separator, end character Separator default sep = ' ' End character default end = '\n'

  11. Introduction to Computer Programming Writing Programs with Input and Output CSCI-UA 2 Reading strings from the keyboard Functions input() Input function variable = input('Prompt ') Input can be in the form of a string or numeric data type However, the value is always assigned to a variable as a string

  12. Introduction to Computer Programming Python Basics CSCI-UA 2 A variable is a name that refers to a Variables value = An “assignment statement” gives a value to a variable Variables remember things Variables can change, too = is Python’s assignment token

  13. Introduction to Computer Programming Python Basics CSCI-UA 2 Can be of any length Variables Characters must be letters, numbers, Naming or the underscore (_) First character cannot be a number Case sensitive Python keywords cannot be used as variable names

  14. 
 Introduction to Computer Programming Python Basics CSCI-UA 2 () Arithmetic Operators ** Highest precedence % to lowest precedence // * / + -

  15. Introduction to Computer Programming Python Basics CSCI-UA 2

Recommend


More recommend