Friday, September 11, 2020

python program to know the effects of any and all functions

 python program to know the effects of any and all functions


 

 

               python program to know the effects of

     'any' and 'all' conditional functions

==================================================

 

code

from numpy import *

arr1 = array([1,2,3,4])

arr2 = array([3,2,1,4])

condition = arr1 > arr2

print('Result of arr1 > arr2',condition)

print('Check if any one element is true:', any(condition))

print("Check if all elements are true", all(condition))

if(any(arr1>arr2)):

    print('a contains at-least one element greater than those of b')

 

output

Result of arr1 > arr2 : [True False False False]

Check if any one element is true : True

Check if all elements are true : False

a contains at-least one element greater than those of b

 

 

 


No comments:

Post a Comment

Durga Puja in Odisha

 Durga Puja in Odisha