Strings: What Does This Print
What does this print? · Beginner · about 6 min
Read each short program and type exactly what it prints, with each printed line on its own line. If a program stops with an error, type the error's name, like TypeError.
Example
s = "dog" print(s[0], len(s))
prints
d 3
Program 1
s = "banana" print(s.count("a"), s.find("n"))
Program 2
word = "Python" print(word[-1], word[-3:])
Program 3
s = "hello" s.upper() print(s)
Program 4
s = "cat" s[0] = "b" print(s)
Program 5
print("a,b,,c".split(","))
Program 6
print("-".join(["2026", "11", "07"]))
Program 7
text = " hi there " print(text.strip().title())
Program 8
print("abc" < "abd", "Zebra" < "apple")