The output of ord('f') - ord('a').
What is 5?
Find the error:
list1 = ("Christian", "Prague", "Brasov", "Hamburg")
for i in list1:
print(item[0])
What is i/item?
The output.
x = 0
y = 47
while ( y >= 10):
y = y // 3
x += y
print(x)
What is 20?
The output of:
b = "Hello, World!"
print(b[2:5])
'ell'
What is an empty string?
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?
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?
The output of:
str1 = "fdsakl"
print( str1[len(str1) - 2].upper() )
What is K?
The output of:
>>> word1 = "banana"
>>> print(word1.find("A"))
What is -1?
print('Hello World!")
What are unmatched quotations/mixed quotation styles?
The number of iterations.
for i in range (36, 22, -5):
print(i)
What is 3?
This function returns a string with the leading and trailing white spaces removed.
What is strip()?
The output of:
>>> greeting = 'Hello World!'
>>> greeting[0] = 'J'
What is a syntax error? (strings are immutable)
num1 = 100
num2 = -5
while ( num2 <= 10):
num1 += num2 * 1.2
print(x)
What is an infinite loop?
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?
This string operator declares that the next character should be interpreted literally.
What is the backslash/escape character?