Hey Folks, Hello Everyone. We returned with a new Assignment Joy Of Computing Using Python Week 4 Programming Assignment. We have been providing the answers since the start of the assignment. We are providing with 100 % Accuracy. Then Why Wait, Come with us till Last Let's solve this week's assignments also.Â
About Swayam NPTEL
Swayam is an initiative by the Government of India's Ministry of Education to provide online education courses for free to anyone who wants to learn. Swayam offers courses on various topics, including engineering, humanities, management, and more.
NPTEL, which stands for National Program on Technology Enhanced Learning, is a joint initiative by IITs and IISc to provide free online courses and study material in engineering, science, and technology. NPTEL offers over 2,000 courses in various domains and is one of India's most popular online learning platforms.
NPTEL Joy Of Computing Using Python Week 4 Programming Assignment 2024
def find_common_birthdays(names, dates):  birth_dict = {}  common = []  # Create a dictionary where keys are dates and values are lists of names born on that date  for name, date in zip(names, dates):    if date not in birth_dict:      birth_dict[date] = [name]    else:      birth_dict[date].append(name)  # Iterate through the birth_dict to find pairs with common dates  for date, name_list in birth_dict.items():    if len(name_list) > 1:      name_list.sort() # Sort the names alphabetically      # Generate pairs of names      for i in range(len(name_list)):        for j in range(i+1, len(name_list)):          pair = [name_list[i], name_list[j]]          # Ensure that only one of the pairs is added          if pair not in common and pair[::-1] not in common:            common.append(pair)  # Sort the list common based on alphabetical order of names within each pair  # and the index of the first name in the original input list  common.sort(key=lambda x: (names.index(x[0]), x[0], x[1]))  return common# Sample Inputnames = input().strip().split(',')dates = list(map(int, input().strip().split(',')))# Find pairs with common birthdatescommon = find_common_birthdays(names, dates)# Printing the result in the desired format {codeBox}
def matrix_product(A, B):Â Â n = len(A)Â Â result = [[0] * n for ads in range(n)]Â Â for i in range(n):Â Â Â Â for j in range(n):Â Â Â Â Â Â for k in range(n):Â Â Â Â Â Â Â Â result[i][j] += A[i][k] * B[k][j]Â Â return(result)# Inputn = int(input())A = []B = []# Input matrix Afor apple in range(n):Â Â row = list(map(int, input().strip().split(',')))Â Â A.append(row)# Input matrix Bfor mango in range(n):Â Â row = list(map(int, input().strip().split(',')))Â Â B.append(row)# Compute matrix product ABAB = matrix_product(A, B)# Outputfor row in AB:Â Â print(','.join(map(str, row))) {codeBox}
   | 3  4 | = | 6 8 |Â
# Read inputn = int(input()) # Dimension of the matrix AA = [] # Initialize matrix A# Input matrix Afor pay in range(n):  row = list(map(int, input().split())) # Read a row of integers  A.append(row)s = int(input()) # Scalar value# Multiply each element of matrix A by the scalar sresult = [[s * A[i][j] for j in range(n)] for i in range(n)]# Print the resultfor row in result:  print(*row) {codeBox}