लिस्ट दी गई है और चेकिंग वैल्यू दी गई है, लिस्ट में उन सभी वैल्यूज़ को प्रदर्शित करें जो दिए गए मान से अधिक हैं।
उदाहरण
Input: A=[10, 20, 30, 40, 50] Given value=20 Output: No Input: A=[10, 20, 30, 40, 50] Given value=5 Output: Yes
एल्गोरिदम
चरण 1: यूजर इनपुट लिस्ट बनाएं। चरण 2: चेकिंग वैल्यू इनपुट करें। चरण 3: फॉर लूप का उपयोग करके लिस्ट में ट्रैवर्स करें। चरण 3.1: सभी वैल्यूज़ की तुलना चेकिंग वैल्यू से करें। चरण 4: रुकें।
उदाहरण कोड
def checknumber(A, val):
# लिस्ट में ट्रैवर्स करें
for i in A:
if val >= i:
return False
return True
# ड्राइवर कोड
A = list()
n1 = int(input("Enter the size of the List ::"))
print("Enter the Element of List ::")
for i in range(int(n1)):
k = int(input(""))
A.append(k)
val = int(input("Enter the checking value"))
if checknumber(A, val):
print("All the values are greater than ", val)
else:
print("Values are not greater than ", val)आउटपुट
Enter the size of the List ::5 Enter the Element of List :: 10 20 30 40 50 Enter the checking value 10 Values are not greater than 10 Enter the size of the List ::6 Enter the Element of List :: 10 20 30 40 50 60 Enter the checking value 9 All the values are greater than 9