NPTEL Joy of Computing Using Python Week 10 Programming Assignment 2023

Hello everyone, we came back with Nptel week 10 programming assignment of Joy Of Computing Using Python. In this article we will discuss the answers for week 10 assignment . Please Use these answers as reference, If any doubt arises feel free to comment in the comment section below. Then why Waiting, Come with us, Let us solve the programming assignment. 

Read More: Joy Of Computing Week 10 Quiz Answers

About NPTEL 

NPTEL (National Program on Technology Enhanced Learning) is an initiative by the Indian government to provide free online courses and study material in engineering, science, and humanities through a platform that is accessible to anyone with an internet connection. The courses are developed and taught by professors from the Indian Institutes of Technology (IITs) and other top educational institutions in India. NPTEL offers courses in a variety of formats including video lectures, online assignments, and quizzes, and provides certification for those who successfully complete the courses. It is a valuable resource for students, educators, and professionals seeking to enhance their knowledge and skills in various fields. 

NPTEL Joy of Computing Using Python Week 10 Programming Assignment 2023

The Joy Of Computing Using Python Week 10 Assignment 

Before going to the assignment, let us see the topics briefly which are present in week 10.The topics Present in this week are :  

  • FLAMES 
  • Data Compression 

FLAMES : 

FLAMES is a popular game played by young people to determine the romantic compatibility between two individuals. The word "FLAMES" is an acronym that stands for "Friends, Lovers, Affectionate, Marriage, Enemies, and Siblings." In the game, the names of the two people are written on a piece of paper, and then each letter in the word "FLAMES" is crossed off one by one based on the number of letters in each person's name.

For example, if one person's name has five letters and the other person's name has six letters, the first letter "F" in "FLAMES" is crossed off, as it is the sixth letter in the word. The process continues until only one letter remains, which indicates the relationship between the two people.

"Friends" means a platonic relationship, "Lovers" means a romantic relationship, "Affectionate" means attraction and fondness without any commitment, "Marriage" means a future together, "Enemies" means dislike or conflict, and "Siblings" means a sibling-like bond without any romantic involvement. The game is meant to be played for fun and should not be taken too seriously. 

Data Compression: 

Data compression is the process of reducing the size of digital data by encoding it in a more efficient way, without losing significant information or quality. The primary goal of data compression is to reduce the amount of storage space required to store digital data and/or to reduce the time and bandwidth needed to transmit it over a network.

There are two types of data compression: lossless and lossy compression. Lossless compression algorithms reduce the size of data without losing any information, while lossy compression algorithms sacrifice some data to achieve a higher level of compression.

Lossless compression algorithms include methods such as run-length encoding, Huffman coding, and Lempel-Ziv-Welch (LZW) compression, which are commonly used for text and image files. Lossy compression algorithms, on the other hand, include methods such as JPEG and MPEG, which are used for compressing images and video files respectively.

Data compression is used in various applications such as image and video compression, audio compression, and in data storage systems. It allows for more efficient use of storage space and can improve data transmission speed, making it an important tool in the field of digital data processing.

Programming Assignment 

Last Date: 06-04-2023

Q1. Given a list L write a program to make a new list and match the numbers inside list L to 
       its respective index in the new list. Put 0 at remaining indexes. Also print the elements of the 
       new list in the single line. (See explanation for more clarity.)

Input:
[1,5,6]

Output:
0 1 0 0 0 5 6

Explanation: 

List L contains 1,5,9 so at 1,5,9, index of new list the respective values are put and rest are initialized as zero. 

Code: 

L=[int(i) for i in input().split()]
ans=[0]*(max(L)+1)
for i in range(len(ans)):
  if i in L:
    ans[i]=i
print(*ans,end="")   {codeBox}

Q2. Ram shifted to a new place recently. There are multiple schools near his locality. Given the
       co-ordinates of Ram P(X,Y) and schools near his locality in a nested list, find the closest 
       school. Print multiple coordinates in respective order if there exists multiple schools 
       closest to him. Write a function closest School that accepts (X ,Y , L) where X and Y are 
       co-ordinates of Ram's house and L contains co-ordinates of different school.

Distance Formula(To calculate distance between two co-ordinates): √((X2 - X1)² + (Y2 - Y1)²)

where (x1,y1) is the co-ordinate of point 1 and (x2, y2) is the co-ordinate of point 2.

Input:
X, Y (Ram's house co-ordinates)
N (No of schools)
X1 Y1
X2 Y2
.
.
.

X6 Y6

Output:
Closest pont/points to X, Y 

Code: 

def closestSchool(x, y, L):
  min=999466
  distance=[]
  for a in L: 
    dis=((x-a[0])**2+(y-a[1])**2)**0.5
    distance.append(dis)
    if dis<min:
      min=dis 
  for i in range(len(distance)):
    if distance[i]==min:
        print(L[i])  {codeBox}

Q3. Given a string s write a program to convert uppercase letters into lowercase and lowercase 
       letters into uppercase. Also print the resultant string.

Note: You need to talk the input and do not print anything while taking input.

Input:
The Joy Of Computing

Output
tHE jOY oF cOMPUTING

Code: 

s=input()
print(s.swapcase(),end="")      {codeBox}


Conclusion: 

I Request everyone to revisit the website on/before to last date for any re-verification of answers.
 
If you have any queries, contact us. I am very thankful to answer you.
 
NOTE: I'm answering these questions to the best of my knowledge.

One Comment Please !

Post a Comment (0)
Previous Post Next Post