All our Data Science projects include bite-sized activities to test your knowledge and practice in an environment with constant feedback.
All our activities include solutions with explanations on how they work and why we chose them.
Check all the correct answers.
Check all the correct answers.
Choose the correct answer.
Choose the correct answer.
Choose the correct answer.
Choose the correct answer.
Check all the correct answers.
Choose the correct answer.
Choose the correct answer.
my_list = [1, 2, 3, 4, 5]
my_list[-1:-4:-1] = [0, 0, 0]
print(my_list)
Check all the correct answers.
my_dict = {'apple': 1, 'banana': 2, 'cherry': 3}
print(my_dict.get('banana', 0), end=',')
print(my_dict.get('orange', 0))
my_list = [1, 2, 3]
my_dict = {'a': 'apple', 'b': 'banana'}
print(my_list + list(my_dict.values()))
Check all the correct answers.
my_list = [1, 2, 3]
print([i * 2 for i in my_list])
Check all the correct answers.
Which of the following is a valid way to create a dictionary with keys based on a list and values based on a second list of the same length?
my_list = [x**2 for x in range(10) if x % 2 == 0]
print(my_list)
Check the correct answers.
Which of the following is a valid way to create a list of integers from 0 to 99 using a list comprehension?
Check the correct answers.
Check the correct answers.
Check the correct answers.
my_dict = {'apple': 2, 'banana': 3, 'orange': 4}
my_dict.update({'apple': 4, 'pear': 1})
print(my_dict)