Farz0l1x

Untitled

May 28th, 2023
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. from random import randint
  2. A = [randint(1, 1000) for j in range(100)]
  3. count = 0
  4. for i in range(len(A)):
  5. for j in range(i + 1, len(A)):
  6. if (A[i] * A[j]) % 7 == 0:
  7. count += 1
  8. print(count)
  9.  
  10. k_7 = 0
  11. k = 0
  12. for i in range(len(A)):
  13. if A[i] % 7 == 0:
  14. k_7 += 1
  15. else:
  16. k += 1
  17. print(k_7 * (k_7 - 1) // 2 + k_7 * k)
Advertisement
Add Comment
Please, Sign In to add comment