Week 11 Quiz
Predict, then check: what does this program print?
s = "Hello" s.upper() print(s)Select one.
- HELLO
- Hello
- None
- hello
Predict, then check: what does this program print?
entry = "day 3: 25 pages" parts = entry.split() print(parts)Select one.
- ['day', '3:', '25', 'pages']
- ['day', '3', '25', 'pages']
- ['day 3: 25 pages']
- ['day', '3:', 25, 'pages']
Predict, then check: what does this program print?
entry = "day 3: 25 pages" parts = entry.split() pages = int(parts[2]) print(pages + 5)Select one.
- 255
- 30
- TypeError
- 25
Predict, then check: what does this program print?
print("a,b c".split())Select one.
- ['a', 'b', 'c']
- ['a', 'b c']
- ['a,b', 'c']
- ['a,b c']
Predict, then check: what does this program print?
s = "Hello, World" print(s.find("z"))Select one.
- False
- −1
- 0
- None
Predict, then check: what does this program print?
s = "Hello, World" if s.find("z"): print("found a z") else: print("no z")Select one.
- found a z
- no z
- TypeError
- Nothing prints
Predict, then check: what does this program print?
note = "buy milk, buy eggs, buy bread" print(note.replace("buy", "get"))Select one.
- get milk, buy eggs, buy bread
- buy milk, buy eggs, buy bread
- get milk, get eggs, get bread
- get milk, get eggs, buy bread
Predict, then check: what does this program print?
print("hello"[::-1])Select one.
- h
- olle
- hello
- olleh
Select every line this program prints.
typed = " Yes " print(typed == "yes") clean = typed.strip().lower() print(clean) print(clean == "yes")Select every option that applies.
- False
- yes
- True
- Yes
- Yes
True or false: in s = "Hello, World", counting positions from 0, the letter W sits at position 7, which is why s.find("W") prints 7.
True or false.
- True
- False
Built with The Course Maker · samples.thecoursemaker.com