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 will be the output for the following list operation ?

sampleList = [10, 20, 30, 40, 50]
print(sampleList[-4:-1])
 
 
 

2. What is the max length of a Python string?

 

 
 
 

3. How can you compare two strings named “client1” and “client2” for alphabetical order?

 
 
 
 

4. What is the output of the following set operation:

sampleSet1 = {"Apples", "Oranges", "Bananas"}
sampleSet2 = {"Oranges", "Grapes", "Lemons"}

sampleSet1.difference_update(sampleSet2)
print(sampleSet1)
 
 

5. What will be the output from this code?

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

6. Which of the following is NOT a Python numeric type?

 
 
 
 

7. What is the value of the following Python Expression

print(36 / 4)

 

 

 
 

8. Select the all correct way to remove Annie’s hourly rate from the following dictionary?

staff = {
   "name": "Annie",
   "department": "Marketing",
   "hourly": 60
}

 

 
 
 

9. What is the output of the following union operation:

set1 = {10, 20, 30, 40}
set2 = {50, 20, "10", 60}

set3 = set1.union(set2)
print(set3)
 
 
 
 

10. What is the most efficient way to concatenate strings with a separator?

 
 
 

11. Which of the following operators has the highest precedence?

 
 
 
 

12. Which method can be used to capture and change the current state of the random generator?

 
 
 
 

13. To generate a random secure Universally unique ID which method should I use

 
 
 
 

14. What is the output of the following list function?

sampleList = [10, 20, 30, 40, 50]
sampleList.pop()
print(sampleList)

sampleList.pop(2)
print(sampleList)


 
 
 

15. How do you  convert the following variable to a string?
num = 3

 
 
 
 

16. What is the type of the following variable:

sampleTuple = ("Apples")
print(type(sampleTuple))
 
 
 
 

17. What is the output of the following:

print(abs(-45.300))
 
 
 
 

18. What is the output of the following:

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

19. What is the output:

print('[%c]' % 65)

 

 
 
 

20. How would you to get the ASCII code of a character?

 
 
 
 

Question 1 of 20

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