11. Check if a string is a pangram (contains every letter of the alphabet at least once)
Required Input:
The quick brown fox jumps over the lazy dog
Expected Output:
True
Code In Python
def is_pangram():
sentence = "The quick brown fox jumps over the lazy dog"
# Your code here
return
Output
Click Run Button to view compiled output
12. Generate a list of prime numbers up to n
Required Input:
10
Expected Output:
[2, 3, 5, 7]
Code In Python
def prime_numbers_up_to_n():
n = 10
# Your code here
return
Output
Click Run Button to view compiled output
13. Merge two dictionaries
Required Input:
{'a': 1, 'b': 2}, {'b': 3, 'c': 4}
Expected Output:
{'a': 1, 'b': 3, 'c': 4}
Code In Python
def merge_dictionaries():
dict1 = {'a': 1, 'b': 2}
dict2 = {'b': 3, 'c': 4}
# Your code here
return
Output
Click Run Button to view compiled output
14. Find the maximum difference between two consecutive elements in a sorted list
Required Input:
[1, 3, 8, 12, 20]
Expected Output:
8
Code In Python
def max_consecutive_difference():
lst = [1, 3, 8, 12, 20]
# Your code here
return
Output
Click Run Button to view compiled output
15. Find the sum of all elements in a nested list
Required Input:
[[1, 2, [3]], [4, 5]]
Expected Output:
15
Code In Python
def sum_nested_list(nested_lst):
# Your code here
return
Output
Click Run Button to view compiled output
16. Reverse the words in a sentence
Required Input:
Python is fun
Expected Output:
fun is Python
Code In Python
def reverse_words():
sentence = "Python is fun"
# Your code here
return
Output
Click Run Button to view compiled output
17. Create a list of all odd numbers between two given numbers (inclusive)
Required Input:
3, 10
Expected Output:
[3, 5, 7, 9]
Code In Python
def odd_numbers_in_range():
start, end = 3, 10
# Your code here
return
Output
Click Run Button to view compiled output
18. Check if a number is an Armstrong number
Required Input:
153
Expected Output:
True
Code In Python
def is_armstrong():
n = 153
# Your code here
return
Output
Click Run Button to view compiled output
19. Find the common divisors of two numbers
Required Input:
12, 18
Expected Output:
[1, 2, 3, 6]
Code In Python
def common_divisors():
a, b = 12, 18
# Your code here
return
Output
Click Run Button to view compiled output
20. Find all palindromic numbers between two given numbers
Required Input:
100, 150
Expected Output:
[101, 111, 121, 131, 141]
Code In Python
def palindromic_numbers():
start, end = 100, 150
# Your code here
return
Output
Click Run Button to view compiled output