Strings & Knots
ERROR
Mission Control
Stringy C(hee)S(e)
100

The output of ord('f') - ord('a').

What is 5?

100

Find the error:

list1 = ("Christian", "Prague", "Brasov", "Hamburg")

for i in list1:

     print(item[0])

What is i/item?

100

The output.

x = 0

y = 47

while ( y >= 10):

    y = y // 3

    x += y

print(x)

What is 20?

100

The output of:

b = "Hello, World!"

print(b[2:5])


'ell'

200
Represented as this ''.

What is an empty string?

200

The output of this is 1, 4, 7, 10, 13.

for i in range(1, 3, 14):

    print(i)

What is mixing up the stop and step parameters of the range function?

200

Check if all branches will be reached and why.

num = int(input("Enter an integer: "))

if (num % 2) == 0:

    print("It's divisible by 2!")

elif (num % 1) == 0:

    print("It's divisible by 1!")

elif (num % 3) == 0:

   print("It's divisible by 3!")

What is branch 3 will never be reached because branch 2 catches all?

200

The output of:

str1 = "fdsakl"

print( str1[len(str1) - 2].upper() )

What is K?

200

The output of:

>>> word1 = "banana"

>>> print(word1.find("A")) 

What is -1?

200

print('Hello World!")

What are unmatched quotations/mixed quotation styles?

200

The number of iterations. 

for i in range (36, 22, -5):

    print(i)

What is 3?

200

This function returns a string with the leading and trailing white spaces removed.

What is strip()?

300

The output of:

>>> greeting = 'Hello World!'

>>> greeting[0] = 'J'

What is a syntax error? (strings are immutable)

300

num1 = 100

num2 = -5

while ( num2 <= 10):

    num1 += num2 * 1.2

print(x)

What is an infinite loop?

300

The output of:

list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

sum = 0

for i in range(5):

    while list1[i % 3] < 1:

        sum += i

print(i)

What is 4?

300

This string operator declares that the next character should be interpreted literally.

What is the backslash/escape character?

M
e
n
u