The Joy of Computing Using Python Programming Exam Unprotected Oct 2022

The-Joy-of-Computing-using-Python-Programming-Exam-Unprotected-Oct-2022

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 Programming Exam Unprotected Oct 2022.

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 !!

The Joy Of Computing Using Python Programming Exam Oct 2022 (Second Session): (8PM - 9PM)

Exam Problem 1

Question 1 : You are in charge of making blueprints of a high-security prison for superhumans. Your task is to take the number of rows and number of columns as input and design the blueprint for the construction.

Input: The first line contains the number of rows N and number of columns M of the prison.

Output: Blueprint of prison according to sample output.

Example:

Input: 3 4

Output:

+-+-+-+-+
|.|.|.|.|
+-+-+-+-+
|.|.|.|.|
+-+-+-+-+
|.|.|.|.|
+-+-+-+-+

				
					x,y = map(int,input().split())
p = ['+' for i in range(y+1)]
q = ['|' for i in range(y+1)]
r = '-'.join(p)
s = '.'.join(q)
for j in range(x):
 print(r)
 print(s)
print(r,end = '')
				
			

Exam Problem 2

Question 2Given a list in which each element is a tuple containing (country, country_code). Write a function convertL that takes the list as an argument and returns a dictionary containing keys as country and values as country_code, arranged in ascending order with respect to country code.

Sample Input:

L = [(Sri Lanka, +94), (India, +91)]

Sample output:

{ ‘India’: ‘+91’, ‘Sri Lanka’: ‘+94’}

				
					def convertL(L):
    item = dict()
    for i in sorted(L):
        item[i[0]] = i[1]
    myDict_values = sorted([int(i) for i in item.values()])
    myDict = dict()

    for i in myDict_values:
        for j in item.keys():
            if item[j] == "+"+str(i):
                myDict[j] = item[j]
    return(myDict)

n = int(input())
L = []
for i in range(n):
    L.append(input().split())

print(convertL(L))
				
			

Programming Exam Oct 2022 (First Session): (10AM - 11AM)

Exam Problem 1

Question 1 : Ramesh is the principal of a school. Every year, he appoints some teachers to calculate the grades of students from the marks scored by them. Since technology is evolving Ramesh wants to digitize this process. So, he decided to hire a programmer for this task. 

You are given a dictionary where the keys are the name, and the values are another dictionary that contains subjects as keys and marks as values. Write a function convertMarks that takes a dictionary as an argument and returns a dictionary with marks replaced with grades. 

Example input:

{‘Lakshman’: {‘Maths’: 90, ‘English’: 75, ‘Social Science’: 10}

Example output:

{‘Lakshman’: {‘Maths’: B, ‘English’: C, ‘Social Science’: F}

				
					def converMarks(num):
    for pupil in d.keys():
        for marks in d[pupil].keys():
            m = d[pupil][marks]
            if m>=91 and m<=100:
                d[pupil][marks] = 'A'
            elif m>=81 and m<=90:
                d[pupil][marks] = 'B'
            elif m>=71 and m<=80:
                d[pupil][marks] = 'C'
            elif m>=61 and m<=70:
                d[pupil][marks] = 'D'
            elif m>=51 and m<=60:
                d[pupil][marks] = 'E+'
            elif m>=41 and m<=50:
                d[pupil][marks] = 'E'
            elif m>=0 and m<=40:
                d[pupil][marks] = 'F'
    return(d)
    
name = input().split()
d = {}
for i in name:
    d[i] = {}
    subjects = input().split()
    marks = input().split()
    for j in range(len(subjects)):
        d[i][subjects[j]] = int(marks[j])

print(converMarks(d))
				
			

Exam Problem 2

Question 2 : Shyam has N Jars of Ladoos and he wants to distribute the Ladoos amongst M Villagers. The i-th jar contains Li pieces of Ladoos. He wants to make sure that every villager gets the same amount of ladoos and that the number of ladoos they receive is the greatest possible. He can open each jar and mix all the ladoos before distributing them to the villagers. How many pieces of ladoos will remain after he shares them amongst villagers, based on the rules described above?

Input: The first line of input contains two integers: integer N, the number of ladoos, and M, number of villagers. The next line contains N non-negative integers.
Output: The remaining number of ladoos according to rule described above.

Input:
7 3
1 2 3 4 5 6 7
Output:
1
				
					n,m=map(int,input().split())
l=[int(i) for i in input().split()]
s=0
for i in l:
  s+=i
print(s%m,end='')