Hey Folks, We returned with a new Assignment Joy Of Computing Using Python Week 3 Programming Assignment. We have been providing the answers since the start of the assignment. We are providing 100 % Accuracy. Then Why Wait, Come with us till Last Let's solve this week's assignments also.
Also Read: Joy Of Computing Week 4 Programming Assignment Answers
Join Telegram:Â Â CLICK HEREÂ for more updates and answers.
NPTEL Joy Of Computing Using Python Week 3 Programming Assignment 2024
Last Date: 15-02-2024
Q1. You are given a list marks that has the marks scored by a class of students in a Mathematics test. Find the median marks and store it in a float variable named median. You can assume that marks is a list of float values.
Procedure to find the median
(1) Sort the marks in ascending order. Do not try to use built-in methods.
(2) If the number of students is odd, then the median is the middle value in the sorted sequence. If the number of students is even, then the median is the arithmetic mean of the two middle values in the sorted sequence.
You do not have to accept input from the console as it has already been provided to you. You do not have to print the output to the console. Input-Output is the responsibility of the auto-grader for this problem.
Program Code:Â
  for i in range(0, len(marks)):   for j in range(i+1, len(marks)):     if marks[i] >= marks[j]:       marks[i], marks[j] = marks[j],marks[i]       Â  #print(marks)     Â  m=len(marks)//2  if len(marks)%2!=0:   median=marks[m]  else:   median=(marks[m-1]+marks[m])/2 {codeBox}
Q2. Accept a string as input, convert it to lower case, sort the string in alphabetical order, and print the sorted string to the console. You can assume that the string will only contain letters.
Program Code:Â
get=input()get=get.lower()print("".join(sorted(get)),end="") {codeBox}
Q3. You are given the dates of birth of two persons, not necessarily from the same family. Your task is to find the younger of the two. If both of them share the same date of birth, then the younger of the two is assumed to be that person whose name comes first in alphabetical order (names will follow Python's capitalize case format).
The input will have four lines. The first two lines correspond to the first person, while the last two lines correspond to the second person. For each person, the first line corresponds to the name and the second line corresponds to the date of birth in DD-MM-YYYY format. Your output should be the name of the younger of the two.
Program Code:Â
p1=input()dob1=input()p2=input()dob2=input()y1=int(dob1.split('-')[2])y2=int(dob2.split('-')[2])m1=int(dob1.split('-')[1])m2=int(dob2.split('-')[1])d1=int(dob1.split('-')[0])d2=int(dob2.split('-')[0])#print(y1,m1,d1)if (y1>y2):Â print(p1,end="")elif (y2>y1):Â print(p2,end="")else:Â if(m1>m2):Â Â print(p1,end="")Â elif(m2>m1):Â Â print(p2,end="")Â else:Â Â if(d1>d2):Â Â Â print(p1,end="")Â Â elif(d2>d1):Â Â Â print(p2,end="")Â Â else:Â Â Â print(min(p1,p2),end="") {codeBox}
Conclusion:Â
If you find any queries or copyright content, please contact us at [email protected]