CEN111: Programming I: International Burch University
CEN111: Programming I: International Burch University
CEN111: Programming I: International Burch University
IBU Lecture 2
International Burch University
Lecture #2
Basic Data Types
Integers
Floating Point Numbers
Strings
Integer: int
A whole number
Be careful not to use commas in your numbers, for example: 1,000
Floating point number: float
A number that contains a decimal point
Has minimum and maximum values
Limited precision
4 is not the same as 4.0
Arithmetic Operators
(Lowest precedence to highest precedence )
+ -
* /
//
%
** 2/1
String: str
A sequence of one or more characters
A string of letters and numbers
Enclosed in quotation marks
Double quoted strings can contain single quotes and vice versa
Triple quotes can span multiple lines
String operators:
+
*
3/1
Variable
A name that refers to a value
An ”assignment statement” gives a value to a variable
Variables remember things
Variables can change, too
= is Python’s assignment token
Variable names
Can be of any length
Characters must be letters, numbers, or the underscore ( )
First character cannot be a number
Case sensitive
Python keywords cannot be used as variable names
4/1