السلام عليكم
ده المسائل
Collection of numbers and I need you to take this collection of numbers and find a maatching pair that is equal to a sum that i give you as well
وده الحل بتاعي
arr = [1,2,4,4]
sm = 8
for i in range(len(arr) - 1):
if arr[i] == arr[i+1]:
if arr[i] + arr[i + 1] == sm:
print(f"{arr[i]} + {arr[i + 1]} = {sm}")
else:
print("Not Found pair")
المشكله هنا انا الIf و Else الاثينين بيشتغلو يعني هنا بيحصل خطاء منطقي الصراحه بس مش عارف احل الخطاء ده ازي ؟