Variables, Expressions, and Statements
Variables, Expressions, and Statements
Chapter 2
Python for Informatics: Exploring Information
Unless otherwise noted, the content of this course material is licensed under a Creative Commons Attribution 3.0 License. .
Copyright 2010- Charles R. Severance
Constants
? Fixed values such as numbers, letters, and strings are called "constants" - because their value does not change
? Numeric constants are as you expect
? String constants use single-quotes (') or double-quotes (")
>>> print 123 123 >>> print 98.6 98.6 >>> print 'Hello world' Hello world
Variables
? A variable is a named place in the memory where a programmer can store data and later retrieve the data using the variable "name"
? Programmers get to choose the names of the variables ? You can change the contents of a variable in a later statement
x = 12.2 y = 14 x = 100
x 12.2 100
y 14
Python Variable Name Rules
? Must start with a letter or underscore _ ? Must consist of letters and numbers and underscores ? Case Sensitive ? Good: spam eggs spam23 _speed ? Bad: 23spam #sign var.12 ? Different: spam Spam SPAM
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- python variable data type conversion tutorial kart
- pygraphviz documentation
- types in python
- use python with r with reticulate cheat sheet
- appendix a command reference
- cs303e elements of computers and programming simple python
- data types
- how to get keys of python dictionary as list
- variables expressions and statements
- python variable types rxjs ggplot2 python data
Related searches
- common english expressions and idioms
- popular expressions and sayings
- meanings of expressions and sayings
- dictionary of expressions and idioms
- calculator for expressions and equations
- expressions and equations practice
- algebraic expressions and equations practice
- identify equations expressions and inequalities
- expressions and equations practice pdf
- expressions and equations answer key
- expressions and equations answers
- writing expressions and equations pdf