Content will go here.

Data Types

Built-In Data Types In Python

IntegerintPositive, negative, or zero whole number, e.g. 7
Floating pointfloatDecimal value, e.g. 12.345
BooleanboolTrue or False value
StringstrImmutable ordered sequence of characters, e.g. "Python!"
TupletupleImmutable ordered sequence of objects, e.g. (3, 2.5, "cat")
ListlistMutable ordered sequence of objects, e.g. ("dog", 7, 9.2)
SetsetUnordered collection of distinct objects, e.g. {"a", "b", "c"}
DictionarydictPairs of keys/values, e.g. {"name":"Bob", "age":42}


Assignment Operators for Numeric Types

OperatorDescriptionExample (a=9, b=2)Result
=Assign a valuea=ba has the value 2
+=Add and assigna+=ba has the value 11
-=Subtract and assigna-=ba has the value 7
*=Multiply and assigna*=ba has the value 18
/=Divide and assigna/=ba has the value 4.5
//=Integer divide and assigna//=ba has the value 4
%=Find remainder and assigna%=ba has the value 1
**=Exponentiate and assigna**=ba has the value 81

Assignment Operators for Strings

OperatorDescriptionExample (s="abc")Result
=Assign a values="def"s has the value "def"
+=Append and assigns+="def"s has the value "abcdef"
*=Repeat and assigns*=2s has the value "abcabc"