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;
10 Cards in this Set
- Front
- Back
- 3rd side (hint)
1 |
Question: What is the function of both upper and lower syntax? |
Answer: upper() returns a copy of the string in which all case-based characters have been uppercased. Lower() returns a copy of the string in which all case-based characters have been lowercased. |
|
2 |
Question: What are Boolean functions and mention some of the Boolean function we talked about? |
Answer: Boolean functions are data types that can only have two values: True or False. Some boolean functions are: isalpha(), isnumeric(), islower(), isspace() istitle(). |
|
3 |
Question: Create a string with your name. Capitalize your name. Now by using join, separate each letter by a comma. |
Answer: nombre = "Carla" print nombre.upper() a = "," print a.join(nombre) |
|
4 |
Question: Once you defined a string, they cannot be changed. The replace method modifies the original string. T/F |
Answer: False, They cannot modify the original string. They create a copy of a string, which they modify and return to the caller. |
|
5 |
Question: Which of the following is correct for the replacing method so that the result is Good Morning? s = "God Morning" a) print s.replace["o", "oo"] b) print s.replace("oo", "o") c) print s.replace("o", "oo", 2) d) print s.replace("o", "oo", 1) |
Answer: d) print s.replace("o", "oo", 1) |
|
6 |
Question: What is the correct syntax for the replace method? |
Answer: str.replace(old, new[, count]) |
|
7 |
Question: What happen in the find function when we are looking for a letter that is not in the original string? |
Answer: It returns -1 |
|
8 |
Question: Create a string that says "Red Car" Find the letter C and set the starting index 1 and ending index 5. Replace the word Car for the word Train. |
Answer: a = "Red Car" a.find("C", 1, 5) a.replace("Car", "Train") |
|
9 |
Question: In the following function and commands, why ocurred an error while joining? a = "Manuel" b = "Peter" print a.join(b) Result in console: PManueleManueltManueleManuelr |
Answer: Because by using join(), you need to use a str separator. The method join() returns a string in which the string elements of sequence have been joined by str separator. |
|
10 |
Question: What does the beg and end means in the find() function? |
Answer: The beg means the starting index and end means the ending index. |