Python Flashcards
(44 cards)
\
Backslash. Prints one backslash.
'
Single quote. Prints a single quote.
"
Double quote. Prints a single double quote.
\a
Bell. Sounds the system bell.
\n
Newline. Moves the cursor to the beginning of next line.
\t
Horizontal tab. Moves cursor forward one tab stop.
+
Addition. Combines two strings or adds two integers.
-
Subtraction.
*
Multiplication. Multiplies a string or integer.
/
Division (true).
//
Division (integer). Divides without a remainder.
%
Modulus. Gives just the remainder.
input ( )
Gets text from the user. Returns the answer as a string.
upper ( )
Returns uppercase version of the string.
lower ( )
Returns lowercase version of the string.
swapcase ( )
Returns a new string where the case of each letter is switched.
capitalize ( )
Returns a new string where the first letter is capitalized and the rest are lowercase.
title ( )
Returns a new string where the first letter of each word is capitalized and all others are lowercase.
strip ( )
Returns a string where all the white space (tabs, spaces, and newlines) at the beginning and end are removed.
replace(old, new [,max])
Returns a string where occurrences of the string ‘old’ are replaced with the string ‘new’. The optional ‘max’ limits the number of replacements.
*=
x *= 5 is equivalent to x = x * 5
/=
x /= 5 is equivalent to x = x / 5
%=
x %= 5 is equivalent to x = x % 5
+=
x += 5 is equivalent to x = x + 5