Python Skill Builder

Python is a jackknife language that can be used for shell scripts, desktop apps, websites, AI. You don’t need to become an expert to use it. Knowing even a little can help you solve problems.

Check where you are at with your Python knowledge using this fun 20 question test. You won’t get any immediate rewards but you will be a better person for it 🙂

1. What is the output of the following:

sampleTuple = "Apples", "Oranges", "Bananas"
item1, item2, item3 = sampleTuple
print(item1)
 
 
 

2. What is the output of this string operation?

testStr = 'Hello'
print(testStr*3)
 
 
 

3. What keyword is used after a try statement to handle exceptions

 
 
 
 

4. What is the value of the following Python Expression

print(36 / 4)

 

 

 
 

5. In Python, Dictionaries are immutable

 
 

6. What is the type of the following variable:

x = -5j

 
 
 
 

7. What is the output of the following code

x = 100
y = 50
print(x and y)
 
 
 
 

8. What will the following code output?

x = 5
y = "Paul"
print(x + y)

 

 
 
 

9. What is the output:

print(10 - 4 * 2)
 
 

10. What will be the output from this code?

testList = ["ApplePie", [1, 2, 3, 4, 5]]
print(testList[0][1])
 
 
 

11. What is the output of the following:

sampleSet = {1, 'Apples', ('abc', 'xyz'), True}
print(sampleSet)
 
 
 

12. What is the output of the following:

testList = [5, 10, 15, 25]
print(testList[::-2])
 
 
 

13. What is the output of the following string operations:

testStr = "Annie has 10 marbles";
print(testStr.isalnum())
 
 

14. What is the output:

print(2%6)

 

 
 
 

15. Given the nested if-else below, what will be the value x when the code executed successfully

x = 0
a = 5
b = 5
if a > 0:
   if b < 0:
      x = x + 5
   elif a > 5:
      x = x + 4
   else:
      x = x + 3
else:
   x = x + 2

print(x)


 
 
 
 

16. What will be the output of the following code ?

sampleTuple = (10, 20, 30, 40, 50, 60, 70, 80)
print(sampleTuple[2:5], sampleTuple[:4], sampleTuple[3:])
 
 
 

17. How do you increment a integer (e.g num = 10) variable by 1?

 
 
 
 

18. How do you output content to the console with Python?

 
 
 
 

19. What is the output of the following code

x = 6
y = 2
print(x // y)
 
 
 

20. Select the command that will convert a variable named “testStr” with value “The most amazing thing in the world” to “The Most Amazing Thing In The World”.

 
 
 
 

Question 1 of 20

Not sure about your answer? Try it out before making your choice.