Content-Length: 825 | pFad | http://github.com/codebasics/data-structures-algorithms-python/pull/76.diff

thub.com 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..08bc290 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,20 @@ +# max = int(input("Enter max number: ")) + +# odd_numbers = [] + +# for i in range(1, max): +# if i % 2 == 1: +# odd_numbers.append(i) + +# print("Odd numbers: ", odd_numbers) + max = int(input("Enter max number: ")) odd_numbers = [] +count = 1 -for i in range(1, max): - if i % 2 == 1: - odd_numbers.append(i) +for i in range(max/2): + odd_numbers.append(count) + count += 2 -print("Odd numbers: ", odd_numbers) +print("Odd numbers: ", odd_numbers) \ No newline at end of file








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/codebasics/data-structures-algorithms-python/pull/76.diff

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy