Exercise 22 - Python Words & Symbols Flashcards
print ‘string’
Prints a string
print “string”
Prints a string
#
(Octothorpe) - starts a comment
+
(Plus) - adds
-
(Minus) - subtracts
/
(Slash) - divides
*
(Asterisk) - multiplies
%
(Percent sign) - mod or modulus function
<
Less than - compares two values or strings, returns True or False
>
Greater than - compares two values or strings, returns True or False
<=
Less than equal - compares two values or strings, returns True or False
> =
Greater than equal - compares two values or strings, returns True or False
=
Assigns a value or string to a variable, I.e., var = “ text” or var = 3
,
Comma, separates lists of things
%s
Format character, string
%d
Format character, number
%r
Format character, returns input, I.e., raw contents of the variable = ‘representation’
% var
Places var in formatter location
% (var1, var2, var3)
Places vars in multiple formatter locations
3.0, for example
Appending .0 to the 3 results in floating point math operations
round()
Rounds a floating point number
False
Logical false