NPTEL Course a fun filled whirlwind tour of 30 hrs, covering everything you need to know to fall in love with the most sought after skill of the 21st century. The course brings programming to your desk with anecdotes, analogies and illustrious examples. Turning abstractions to insights and engineering to art, the course focuses primarily to inspire the learner’s mind to think logically and arrive at a solution programmatically. As part of the course, you will be learning how to practice and culture the art of programming with Python as a language. At the end of the course, we introduce some of the current advances in computing to motivate the enthusiastic learner to pursue further directions. The Joy of Computing using python is a fun filled course offered by NPTEL.

**The Joy Of Computing Using Python Week 10 Assignment 2023.**

**INTENDED AUDIENCE : **Any interested audience**PREREQUISITES :** 10th standard/high school**INDUSTRY SUPPORT : **Every software company is aware of the potential of a first course in computer science. Especially of a first course in computing, done right.

### Course Layout

- Motivation for Computing
- Welcome to Programming!!
- Variables and Expressions : Design your own calculator
- Loops and Conditionals : Hopscotch once again
- Lists, Tuples and Conditionals : Lets go on a trip
- Abstraction Everywhere : Apps in your phone
- Counting Candies : Crowd to the rescue
- Birthday Paradox : Find your twin
- Google Translate : Speak in any Language
- Currency Converter : Count your foreign trip expenses
- Monte Hall : 3 doors and a twist
- Sorting : Arrange the books
- Searching : Find in seconds
- Substitution Cipher : What’s the secret !!
- Sentiment Analysis : Analyse your Facebook data
- 20 questions game : I can read your mind
- Permutations : Jumbled Words
- Spot the similarities : Dobble game
- Count the words : Hundreds, Thousands or Millions.
- Rock, Paper and Scissor : Cheating not allowed !!
- Lie detector : No lies, only TRUTH
- Calculation of the Area : Don’t measure.
- Six degrees of separation : Meet your favourites
- Image Processing : Fun with images
- Tic tac toe : Let’s play
- Snakes and Ladders : Down the memory lane.
- Recursion : Tower of Hanoi
- Page Rank : How Google Works !!

**Programming Assignment 1**

**Question 1** : Given a list L, write a program to make a new list to fix the indexes of numbers in the list L to its same value 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

` ````
```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="")

**Programming Assignment 2**

**Question 2** : 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 are given in a nested list, find the closest school. Print multiple coordinates in respective order if there exist multiple schools closest to him. Write a function closestSchool 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 point/points to X, Y

` ````
```import math
def closestSchool(x,y, L):
minD = 1000000
distance = []
for i in L:
x1, y1 = i[0], i[1]
d = math.sqrt((x1-x)**2 + (y1-y)**2)
if d

**Programming Assignment 3**

**Question 3** : Given a string s write a program to convert uppercase letters into lowercase and lowercase letters into uppercase. Also print the resultant string.

Input:

The Joy Of Computing

Output

tHE jOY oF cOMPUTING

` ````
```import string
import random
upper = string.ascii_uppercase
lower = string.ascii_letters
s = input()
ans = ''
for i in s:
if i in upper:
idx = upper.index(i)
ans += lower[idx]
elif i in lower:
idx = lower.index(i)
ans += upper[idx]
else:
ans+=i
print(ans,end='')