From bfde83cde399f995df5098be50e54e179e3db47a Mon Sep 17 00:00:00 2001 From: Ayush Gupta <79574192+iayushbhartiya@users.noreply.github.com> Date: Sun, 10 Apr 2022 14:01:27 +0530 Subject: [PATCH] Update 3_odd_even_numbers.py --- data_structures/2_Arrays/Solution/3_odd_even_numbers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 ec1c4b7..7a9e237 100644 --- a/data_structures/2_Arrays/Solution/3_odd_even_numbers.py +++ b/data_structures/2_Arrays/Solution/3_odd_even_numbers.py @@ -1,7 +1,11 @@ max = int(input("Enter max number: ")) odd_numbers = [] - +#if number will be odd in that case it will omit the last number for that +if max % 2 == 0: + max = max +else: + max += 1 for i in range(1, max): if i % 2 == 1: odd_numbers.append(i)