Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1name = 'hello' name.Upper() | AError: replace() needs 2 arguments | |
| 2'hello'.replace('l') | BOk: Returns ['a','b','c'] | |
| 3' hi '.strip() | CError: Method names are lowercase | |
| 4'a,b,c'.split(',') | DValid: Returns 'hi' | |
| 5print('hello'.upper()) | EOutput: Hi | |
| 6print('hi'.replace('h','H')) | FOutput: HELLO |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
.upper() — Returns the string in all uppercase letters.~~.lower()name = 'hello'
print(name.upper())name = 'HELLO'
print(name.lower())msg = 'I like cats'
print(msg.replace('cats', 'dogs'))text = ' hi '
print(text.strip())csv = 'a,b,c'
print(csv.split(','))