The Joy of Computing using Python Coding Assignment 4 Answers:- Hello students in this article we are going to share NPTEL The Joy of Computing using Python assignment week 4 answers. All the Answers provided below to help the students as a reference, You must submit your assignment at your own knowledge.
Below you can find The Joy of Computing using Python Coding Assignment 4 Answers
Assignment No. | Answers |
---|---|
The Joy of Computing using Python Assignment 1 | Click Here |
The Joy of Computing using Python Assignment 2 | Click Here |
The Joy of Computing using Python Assignment 3 | Click Here |
The Joy of Computing using Python Assignment 4 | Click Here |
The Joy of Computing using Python Assignment 5 | Click Here |
The Joy of Computing using Python Assignment 6 | Click Here |
The Joy of Computing using Python Assignment 7 | Click Here |
The Joy of Computing using Python Assignment 8 | Click Here |
The Joy of Computing using Python Coding Assignment 4 Answers 2022:-
Q1. Take two numbers N and K as an input. Create a list L of length N and initialize it with zeros. Change the value to 1 of even indexes if k is even, otherwise change the value of odd indexes. Print list L in the end.(Consider 0 as even)
Code:- For Week 4 quiz assignment click here
N=int(input())
K=int(input())
L=[]
if K%2!=0:
for x in range(N):
if x%2==0:
L.append(0)
else:
L.append(1)
else:
for x in range(N):
if x%2!=0:
L.append(0)
else:
L.append(1)
print(L,end="")
Q2. Write a program to take string S as an input and replace all vowels by *. Also print the modified string.
Code:-
S=input()
v=list('aeiou')
a=""
for i in S:
if i.lower() in v:
a=a+'*'
else:
a=a+i
print(a,end="")
Next Week Assignment Answers
Q3. Write a program to take an integer N as an input and display the pattern.
Code:-
N=int(input())
for i in range(N):
for j in range(i+1):
print('* ',end="")
print()
for i in range(N-1,0,-1):
for j in range(i):
print("* ",end="")
if j!=0:
print()
For Internship and job updates:- Visit
Disclaimer: We do not claim 100% surety of answers, these answers are based on our sole knowledge, and by posting these answers we are just trying to help students, so we urge do your assignment on your own.
if you have any suggestions then comment below or contact us at [email protected]
If you found this article Interesting and helpful, don’t forget to share it with your friends to get this information.