def is_list_even(my_list):
for i in my_list:
if(i%2 != 0):
return False
return True
def is_list_odd(my_list):
for i in my_list:
if(i%2 == 0):
return False
return True
def main():
n = int(input())
lst = []
for i in range(n):
lst.append(int(input()))
if(is_list_even(lst)):
print('all even')
elif(is_list_odd(lst)):
print('all odd')
else:
print('not even or odd')
if __name__ == '__main__':
main()
I have roblox and I would like to be friends on it
// Variable to keep track of array size
int length = 0;
// Array itself
int array[] = {};
// while loop will take input in the array until a negative number is entered
while(input>=0){
stdin = new Scanner(System.in);
array[length] = stdin;
length +=1;
}
// int variable to terminate while loop
int i =0;
// keep track of index of output array
int y =0;
while(arr[i] != length){
// making output array
int output[]={}; bool flag;
// put the element in out put array considering if it the desired one
output[y] = array [i];
// Now check if it was the desired?
for(int z=1;z<=length;z++){
if(array[i+z]!=output[y]){
flag = true;
}
else
{
output[y]=0;
y+=1;
}
if(array[i+z+1]=output[y] && flag == true){
output[y] = array[i];
y+=1;
}
}
//output the array
for(int o=0;o<y;o++)
System.out.println(output[o];
Not sure whether this question is requires a specific answer but I would say Waze.