একটি লিস্ট দেওয়া আছে এবং চেক করার মান দেওয়া আছে, লিস্টের যেসব মান দেওয়া মানের চেয়ে বড় সেগুলো প্রদর্শন করুন।
উদাহরণ
Input : A=[10, 20, 30, 40, 50] Given value=20 Output : No Input : A=[10, 20, 30, 40, 50] Given value=5 Output : Yes
অ্যালগরিদম
ধাপ ১: ইউজার ইনপুট লিস্ট তৈরি করুন। ধাপ ২: চেক করার মান ইনপুট নিন। ধাপ ৩: ফর লুপ ব্যবহার করে লিস্টে ট্রাভার্স করুন ধাপ ৩.১: সকল মানকে চেক করার মানের সাথে তুলনা করুন। ধাপ ৪: স্টপ
উদাহরণ কোড
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