Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
19 Cards in this Set
- Front
- Back
print('GO'*3) |
GOGOGO |
|
school = "Luther's College" print(school[2]) |
t |
|
ss = "Hello" print(ss.upper()) print(ss.lower()) |
HELLO hello |
|
ss = "Hello" print(ss.count("l")) (counts the l) |
2 |
|
ss = "Hello" print(ss.replace("H", "belly")) |
bellyello |
|
ss = 'HELLO' print(ss.find("L")) print(ss.rfind("L")) |
Does index position find is left, rfind is right most 2 3 |
|
ss = 'HELLO' print(ss.index("L")) print(ss.rindex("L")) |
2 3 |
|
Difference between index & find? |
Same thing as find but causes run time error if not found |
|
ss = " hello " print(ss.strip()) print(ss.rstrip()) print(ss.lstrip()) |
"hello" " hello" "hello " |
|
fruit = "Banana" print(len(fruit)) |
6 |
|
ss = "Hello" print(ss[0:4]) |
Hell |
|
Are string's mutable? |
False |
|
Gret = "Hello" Gret[0] = 'J' print(Gret) |
#ERROR |
|
Make a remove vowels function |
def remove_vowels(a): '''(str) -> str ''' vowels = "aeiouAEIOU" new = '' for i in vowels: if i not in vowels: new = new + i return new
|
|
a = "bca" print("".join(sorted(a))) |
abc |
|
string1 = "5" print(string1.isdigit()) |
True |
|
string1 = "abcd" print(string1.capitalize()) |
Abcd |
|
how to tell if a function is odd or even? |
a = 9 if not (a % 2 == 0): print('odd') else: print('even') |
|
How to find the reverse of a string? |
a = "ABCD" new = '' for i in a: new = i + new print(new) |