Hey Folks, Hope you are doing well. In this article i am providing the solutions for week 11 Joy of Computing Using Python Programming Answers.
Also Read:Â Joy Of Computing Week 11 Quiz Answers
Also Read:Â Joy of Computing Week 10 Quiz Answers
NPTEL Joy Of Computing Using Python Week 11 Programming AnswersÂ
Last Date: 12-10-2023
Q1. Take 3 sides of a triangle as an input and find whether that triangle is a right angled triangle or not. Print 'YES' if a triangle is right angled triangle or 'NO' if it's not.
Input:
3
4
5
Output
YES
Program Code:Â
a1=int(input())
b3=int(input())
c=int(input())
L=[a1,b3,c]
h=max(L)
L.remove(h)
if h**2==L[0]**2+L[1]**2:
 print("YES",end="")
else:
 print("NO",end="") {codeBox}
Q2. Write a program that accepts a hash-separated sequence of words as input and prints the words in a hash-separated sequence after sorting them alphabetically in reverse order.
Input:
hey#input#bye
Output:
input#hey#bye
Program Code:Â
LGF=sorted(input().split("#"),reverse=True)
print("#".join(LGF),end="") {codeBox}
Q3. Write a program which takes two integer a and b and prints all composite numbers between a and b.(both numbers are inclusive)
Input:
10
20
Output:
10
12
14
15
16
18
20
Program Code:Â
prime_nb=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53,Â
    59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113,
    127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181,Â
    191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251,
    257, 263, 269, 271, 277, 281, 283, 293]
a=int(input())
b=int(input())
for i in range(a,b+1):
  if i not in prime_nb:
   print(i) {codeBox}