Skip to content

Commit bfde83c

Browse files
Update 3_odd_even_numbers.py
1 parent 6b8a495 commit bfde83c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

data_structures/2_Arrays/Solution/3_odd_even_numbers.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
max = int(input("Enter max number: "))
22

33
odd_numbers = []
4-
4+
#if number will be odd in that case it will omit the last number for that
5+
if max % 2 == 0:
6+
max = max
7+
else:
8+
max += 1
59
for i in range(1, max):
610
if i % 2 == 1:
711
odd_numbers.append(i)

0 commit comments

Comments
 (0)