196k views
3 votes
An array of strings , names , has been declared and initialized . write the statements needed to determine whether any of the the array elements are null or refer to the empty string . set the variable hasempty to true if any elements are null or empty-- otherwise set it to false .

1 Answer

4 votes
#Python

hasempty = False
for name in names:
if ( not name ):
hasempty = True
break # speed things up
User Mdarefull
by
7.4k points