The Joy of Computing using Python Week 4: Programming Assignment - Jan-Jun 2022

  NPTEL PROGRAMMING ASSIGNMENTS

The Joy of Computing Using Python

Week 4: Programming Assignment 1

Due Date of Submission 2022-02-24, 23:59 IST
You are given an integer n. Write a program to print a right angle triangle. (See output of public test cases for the pattern)
(input will be handled by us)
Input
5

Output

         *
       **
     ***
   ****
 *****



n = int(input())

 

 




Week 4: Programming Assignment 2

Due Date of Submission 2022-02-24, 23:59 IST
You are given a string s. Print the string s with every consonant in s replaced by _.
(input will be handled by us)

Input
weekend

output
_ee_e__

Explanation
Consonants w, k, n, d in weekend is replaced by _ and string s printed with the changes.


s = input()

 

 




Week 4: Programming Assignment 3

Due Date of Submission 2022-02-24, 23:59 IST
You are given a list L. Write a program to print all numbers in the list which are exactly repeated twice. The order of numbers should be same as in list.(for example if 3 appeared before 2 3 should be printed first.) 
If no such number exist do not print anything. (input will be handled by us)

Input
[2,2,3,4,5,6,6,7,8,8,8,10, 3]

output
2
3
6

Explanation
Since 2, 3 and 6 is repeated 2 times output is 2, 3 and 6, whereas 8 is repeated 3 times so it is not printed.


L = [int(i) for i in input().split()]

 

 


Post a Comment (0)
Previous Post Next Post