NPTEL The Joy Of Computing Using Python Week 10 Assignment

The Joy Of Computing Using Python Week 10

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.

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 : Digit: You are provided with a number D containing only digits 0’s and 1’s. Your aim is to convert this number to have all the digits same.

For that, you will change exactly one digit i.e. from 0 to 1 or from 1 to 0. If it is possible to make all digits equal (either all 0’s or all 1’s) by flipping exactly 1 digit then output “YES“, else print “NO” (quotes for clarity).
					numbers = []
ls = []
x = input()
li = str(x)
for j in li:

for j in numbers:
    count_z = 0
    count_o = 0
    for k in j:
            count_o += 1
            count_z += 1
    if((count_o == 1) or (count_z == 1)):
        if((count_o == 0) or (count_z == 0)):

Programming Assignment 2

Question 1 : Missing NumberGiven a list of n-1 numbers ranging from 1 to n, your task is to find the missing number. There are no duplicates. 

					# getMissingNo takes list as argument 
def getMissingNo(A): 
    n = len(A) 
    total = (n+1)*(n+2)/2
    sum_of_A = sum(A) 
    return total - sum_of_A 
# Driver program to test above function 
li= list(map(int, input ().split ())) 
miss = getMissingNo(li) 

Programming Assignment 3

Question 1 : RearrangementGiven a list A of elements of length N, ranging from 1 to N. All elements may not be present in the array. If the element is not present then there will be -1 present in the array. Rearrange the array such that A[i] = i and if i is not present display -1 at that place.

					def fix( A, len): 
    for i in range(0, len):  
        if (A[i] != -1 and A[i] != i): 
            x = A[i]; 
            # check if desired place 
            # is not vacate 
            while (A[x] != -1 and A[x] != x): 
                #store the value from 
                # desired place 
                y = A[x] 
                # place the x to its correct 
                # position 
                A[x] = x 
                # now y will become x, now 
                # search the place for x 
                x = y 
            # place the x to its correct 
            # position 
            A[x] = x; 
            # check if while loop hasn't 
            # set the correct value at A[i] 
            if (A[i] != i) : 
                # if not then put -1 at 
                # the vacated place 
                A[i] = -1; 
# Driver function. 
A = [] 
A= list(map(int, input ().split ())) 
fix(A, len(A)) 
for i in range(0, len(A)):
        print(A[i],end = '')
        print (A[i],end = ' ') 

Leave a Reply

Your email address will not be published. Required fields are marked *