From 5f63ae9470d7d2bc1dc288b39560a2be2438e719 Mon Sep 17 00:00:00 2001 From: shubham2751 <48217061+shubham2751@users.noreply.github.com> Date: Thu, 1 Oct 2020 11:02:04 +0530 Subject: [PATCH] Update 3_odd_even_numbers.py --- .../2_Arrays/Solution/3_odd_even_numbers.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/data_structures/2_Arrays/Solution/3_odd_even_numbers.py b/data_structures/2_Arrays/Solution/3_odd_even_numbers.py index 334b53c..5be6560 100644 --- a/data_structures/2_Arrays/Solution/3_odd_even_numbers.py +++ b/data_structures/2_Arrays/Solution/3_odd_even_numbers.py @@ -1,9 +1,6 @@ max = int(input("Enter max number: ")) -odd_numbers = [] - -for i in range(max): - if i%2 == 1: - odd_numbers.append(i) - -print("Odd numbers: ",odd_numbers) +if max & 1 == 1: # if the max = 11 ; 11 & 1 it will give 1 then the remaining value is 1 which will lead to ODD Number else EVEN Number(also can use "and" otherthan "&") + print("ODD") +else: + print("EVEN")