NPTEL PROGRAMMING ASSIGNMENTS
The Joy of Computing Using Python
Week 8 Programming Assignment 1
Last Day of Submission: 23-Mar-2023
Given a Tuple T, create a function squareT that accepts one argument and returns a tuple containing similar elements given in tuple T and its sqaures in sequence.
Input Formate:
Integer, list
Output Formate:
Tuple
Input:
5
1 2 3 4 5
1 2 3 4 5
Output:
(1, 2, 3, 4, 5, 1, 4, 9, 16, 25)
if __name__ == "__main__":
n = int(input())
L = list(map(int, input().split()))
T = tuple(L)
ans = squareT(T)
if type(ans) == type(T):
print(ans)
L = list(map(int, input().split()))
T = tuple(L)
ans = squareT(T)
if type(ans) == type(T):
print(ans)
Week 8 Programming Assignment 2
Last Day of Submission: 23-Mar-2022
Given a string S, write a function replaceV that accepts a string and replace the occurrences of 3 consecutive vowels with _ in that string. Make sure to return and print the answer string.
Input Formate:
string
Output Formate:
string
Input
Output
Input
aaappleee
Output
_ppl_
Week 8 Programming Assignment 3
Last Day of Submission: 23-Mar-2022
Write a program that take list L as an input and shifts all zeroes in list L towards the right by maintaining the order of the list. Also print the new list.
Input Formate:
List
Output Formate:
List
Input
Input
[0, 1, 0, 2, 3]
Output
[1, 2, 3, 0, 0]
[1, 2, 3, 0, 0]