Python Quiz

301. What is the result of:

sum([i for i in range(4)])
302. Which keyword allows a function to access a global variable for modification?
303. What does this return?

len(set([1, 2, 2, 3]))
304. Which statement is true about Python tuples?
305. Which of the following will raise a `ValueError`?
306. What is the output of:

print(' '.join(['a', 'b', 'c']))
307. Which of these is used to define a constant in Python by convention?
308. What does this list comprehension do?

[x for x in range(10) if x % 2 == 0]
309. Which keyword is used to pass control to the outer loop in nested loops?
310. Which data type would be best for representing a collection of unique items?

Explore Programming Topics