str Flashcards
s.capitalize()
returns a copy of s with first character capitalized
s.count(target)
returns the number of occurences of target in s
s.find(target)
returns the index of the first occurrence of target in s
s.lower()
returns lowercase copy of s
s.replace(old, new)
returns copy of s with every occurrence of old replaced with new
s.split()
returns list of substrings of s
s.strip()
returns copy of s without leading and trailing whitespace
s.upper()
returns uppercase copy of s
new-line character
‘\n’
tab character
‘\t’
single quote character
’'’
double quote character
’"’
backslash character
’\’
13//3 vs 13//3
3+3+3+3+1 so
13//3=4 (int division)
13/3=4.3333 (float division)
13%3
3+3+3+3+1 so 13%3=1
(remainder in integer division)