The Joy of Computing using Python NPTEL Week 9 Programming Assignment 3 Solution 2021 March | Week 9

The Joy of Computing using Python NPTEL Week 9 Programming Assignment 3 Solution 2021 March | Week 9

 The Joy of Computing using Python NPTEL Week 9 Programming Assignment 3 Solution 2021 March | Week 9









Week 9 Programming Assignment 1                                                          Due on 2021-03-25, 23:59 IST
Repetition
Given a list of integers and a value k, you are required to print an integer which appears in the list exactly k times. It is guaranteed that only one integer repeats k times.
Input Format
The first line of the input contains space separated integers.
Second line of the input contains a value n.
Output Format
Print an integer that appears exactly n times.
Example:
Input:
1 2 3 4 3 2 1 2 5 6
3
Output:
2
Explanation
In the given list, 2 appears exactly thrice.


ANSWER:
                   


a,k=list(map(int, input().split())) ,int(input())
print([q  for q in a if a.count(q)==k][0],end="" )




Week 9 Programming Assignment 2                                                           Due on 2021-03-25, 23:59 IST
Panagrams
Given an English sentence, check whether it is a panagram or not. A panagram is a sentence containing all 26 letters in the English alphabet.

Input Format
A single line of the input contains a stirng s.
Output Format
Print Yes or No

Example:
Input:
The quick brown fox jumps over a lazy dog
Output:
Yes
Input:
The world will be taken over by AI
Output:
No



ANSWER :


                                     



import string as st
s=list(input().upper())
if list(st.ascii_uppercase) == sorted(list(set(sorted(s)[sorted(s).index('A'):]))):
    print("Yes",end="")
else:
    print('No',end="")










Week 9 Programming Assignment 3                                                       Due on 2021-03-25, 23:59 IST
Remove Vowels
Given a string s, remove all the vowels in s and reprint the string. The order of other characters in the string should be maintained\\

Input Format
A single line of the input contains a stirng s.

Output Format
Print the modified string after removing the vowels

Example:

Input:
abcdEfghi

Output:
bcdfgh



ANSWER:
   

                              




S,a=list(input()),""
ans=[y for y in S if y!='A'and y!='E'and y!='O'and y!='U'and y!='I'and y!='a'and y!='e'and y!='i'and y!='o'and y!='u' ]
print(a.join(ans),end="")




Hope this post helped you, you must SUBSCRIBE to the channel to get all these updates in time




VIDEO ACADEMY

Author & Editor

I am a professional youtuber and blogger. My only effort is to present to you various educational issuesLet's hope this effort helps you in the right way. Thank you

0 Post a Comment:

Post a Comment

Please do not enter any spam link in the comment box