Member-only story
4 Practice Questions To Test Your Python Skills
As Computer Science and Coding has become exponentially more popular in the past couple of years, we see more and more students & professionals starting to pick up skills in programming.
As a software-engineer and part-time Python tutor, I’ve compiled 4 basic to intermediate level Python questions that most of my students has faced difficulty in solving sometime in the past. The questions will be listed first, and the answers and explanations will be available further down below.
Prime Numbers
A prime number is a number that is divisible by 1 and itself (1 is NOT a prime number). Write a function is_prime that takes in an integer, and returns True if it is a prime number and False otherwise.
Sum of Prime Numbers
You are given a list containing integers. Write a function sum_prime that takes in this list, and returns the sum of only the prime numbers inside the list (ignore the non-prime numbers). Hint: use the previous is_prime function.
Capitalising Vowels
Write a function capitalise_vowels that takes in a string, and returns another string where only the vowels are capitalised and non-vowels are lowercase. Vowels in the English alphabet refer to “a”, “e”, “i”, “o” or “u”, and…