<jupyter_start><jupyter_text>Coding Challange - 01 - Solution  Question 1:Print the following tuple in reverse order.tuple_1 = (22, 65, 12, 54) Expected Output:(54, 12, 65, 22)<jupyter_code>tuple_1 = (22, 65, 12, 54)

print(tuple_1[::-1])<jupyter_output>(54, 12, 65, 22)<jupyter_text>Question 2:Access the name 'David' from the list given below.myList = [(2, 14, 'David'), [2, 7], 'Shaun'] Expected Output:'David'<jupyter_code>myList = [(2, 14, 'David'), [2, 7], 'Shaun']

myList[0][2]<jupyter_output><empty_output><jupyter_text>Question 3:We have a set and a dictionary given below. Print the set once again after adding the keys of the dictionary to the set. The order of the expected output may vary as it is a set.mySet = {2, 4, 6}myDict = {'A':'John', 'B':'Emma', 'C':'Sam'} Expected Output:{2, 4, 6, 'A', 'C', 'B'}<jupyter_code>mySet = {2, 4, 6}
myDict = {'A':'John', 'B':'Emma', 'C':'Sam'}

mySet.update(myDict.keys())
print(myList)<jupyter_output>[(2, 14, 'David'), [2, 7], 'Shaun']<jupyter_text>Question 4:We have two sets given below. Print all the items from these sets after removing the duplicates.set_1 = {2, 4, 6, 8}set_2 = {6, 8, 10, 12} Expected Output:{2, 4, 6, 8, 10, 12}<jupyter_code>set_1 = {2, 4, 6, 8}
set_2 = {6, 8, 10, 12}

print(set_1.union(set_2))<jupyter_output>{2, 4, 6, 8, 10, 12}<jupyter_text>Question 5:Write a Python program to print the first and the last second of the day. Expected Output:First Second:  00:00:00Last Second:  23:59:59.999999<jupyter_code>import datetime

print("First Second: ", datetime.time.min)
print("Last Second: ", datetime.time.max)<jupyter_output>First Second:  00:00:00
Last Second:  23:59:59.999999<jupyter_text>Question 6:Print the total number of digits in the number given below.num = 8842 Expected Output:Total digits are:  4<jupyter_code>num = 8842

count = 0
while num != 0:
    num //= 10
    count += 1

print("Total digits are: ", count)<jupyter_output>Total digits are:  4<jupyter_text>Question 7:We have a list of lists that contains several numbers. I want you to print the list whose sum of elements is the highest and also the lowest.num_list = [[2, 8, 11], [4, 5, 7, 12], [8, 9, 10, 11], [19, 13, 7], [2, 5, 16]] Expected Output:The list with the maximum sum of elements:  [19, 13, 7]The list with the minimum sum of elements:  [2, 8, 11]<jupyter_code>num_list = [[2, 8, 11], [4, 5, 7, 12], [8, 9, 10, 11], [19, 13, 7], [2, 5, 16]]

print("The list with maximum sum of elements: ", max(num_list, key = sum))
print("The list with minimum sum of elements: ", min(num_list, key = sum))<jupyter_output>The list with maximum sum of elements:  [19, 13, 7]
The list with minimum sum of elements:  [2, 8, 11]<jupyter_text>Explanation: Some functions such as max(), min() can take a python lambda, which is applied to each element before the max(), or min() operation. This is further explained in the upcoming lecture on Python Lambda.  Question 8:We have a string that contains the names of different fruits. I want you to convert this string into multiple substrings where each substring includes one fruit's name.fruits_string = " Apple, Banana, Mango, Kiwi, Guava, Grapes, Pomegranate, Orange, Watermelon" Expected Output: Apple Banana Mango Kiwi Guava Grapes Pomegranate Orange Watermelon<jupyter_code>fruits_string = " Apple, Banana, Mango, Kiwi, Guava, Grapes, Pomegranate, Orange, Watermelon"

substring = fruits_string.split(',')

for fruits in substring:
    print(fruits)<jupyter_output>Apple
 Banana
 Mango
 Kiwi
 Guava
 Grapes
 Pomegranate
 Orange
 Watermelon<jupyter_text>Question 9:Write a program to reverse words in a string.sample_text = "Python is a high-level and general-purpose programming language" Expected Output:language programming general-purpose and high-level a is Python<jupyter_code>sample_text = "Python is a high-level and general-purpose programming language"

print(' '.join(sample_text.split()[::-1]))<jupyter_output>language programming general-purpose and high-level a is Python<jupyter_text>Question 10:Given below is the height (in cm) of the top 10 students in a class. Print the heights of the top 3 students from the given list.heights = [177, 160, 171, 163, 168,  175, 176, 183, 162, 170] Expected Output:Top Three Heights:  [183, 177, 176]<jupyter_code>heights = [177, 160, 171, 163, 168, 175, 176, 183, 162, 170]

top_three = sorted(heights)

print('Top Three Heights: ', top_three[:-4:-1])<jupyter_output>Top Three Heights:  [183, 177, 176]
{'fraction_non_alphanumeric': 0.12875729026469268, 'fraction_numerical': 0.07133243606998654, 'mean_word_length': 5.342816500711238, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '478172', 'license': 'MIT', 'n_tokens_mistral': 1819, 'n_tokens_neox': 1533, 'n_words': 569, 'path': 'coding-challange-01-solution.ipynb', 'repo_name': 'LearningJournal/Python-Foundation-Course', 'size': '4458'}