All must be knowing what is a Odd Number in Mathematics.
If the number is not divisible by 2 then the number is called as Odd Number and it’s just the opposite of even number.
In this post we are going to write a program using different methods which will accept a number “n” and will return all the odd numbers between 1 to n.
List Comprehensions – Odd numbers
Method 1: Let’s write the program using List Comprehension Method.
Here the odd_numbers function returns a list of odd numbers between 1 and n(n is inclusive).
I want to return only the odd numbers in a list.
def odd_numbers(n):
odd_number_list = [num for num in range(1, n+1) if num % 2 == 1]
return odd_number_list
print(odd_numbers(6))
print(odd_numbers(10))
print(odd_numbers(11))
Here is your output:
[1, 3, 5]
[1, 3, 5, 7, 9]
[1, 3, 5, 7, 9, 11]

Method 2: Here we are going to write the program using for loop. we need to check if the input number is not divisible by 2. If the number is not divisible by 2, then we have to print it.
# input the number from keyboard
number = int(input("Enter a number: "))
print("\nOdd numbers from 1 to", number, "are : ")
for num in range(1, number + 1):
#Check if the number is odd or not.
if((num % 2) != 0):
print(num," ")
Here is the output:
Enter a number: 3
Odd numbers from 1 to 3 are :
1
3

erotik izle
I do not even understand how I stopped up right here, however I thought this put up used to be good. Floria Osbourn Korns
sikis izle
Hello. This article was extremely fascinating, especially since I was browsing for thoughts on this subject last Thursday. Barb Nestor Kinata
sikis izle
Hi, just wanted to tell you, I enjoyed this article. Bab Creight Gorrian
erotik izle
You are my breathing in, I own few web logs and infrequently run out from to post . Auguste Torrance Shanan
sikis izle
You are my inspiration , I own few blogs and occasionally run out from to brand. Biddy Reginauld Bleier
erotik izle
Ahaa, its good discussion on the topic of this piece of writing here at this website, I have read all that, so at this time me also commenting here. Gwenny Bennie Onia
erotik
Way cool! Some extremely valid points! I appreciate you writing this article and the rest of the website is really good.
erotik izle
Thanks to my father who shared with me on the topic of this website, this blog is actually awesome. Hally Isaiah Trace
erotik
You are my inspiration , I have few web logs and rarely run out from to brand. Jinny Enrico Evita
erotik
Undeniably believe that which you said. Your favorite reason appeared to be on the net the simplest thing to keep in mind of. Rhianon Armstrong Mihalco
erotik izle
Sadly, I have run across this. One family member has tons of photos of my paternal side and refuses to share with anyone. Jade Andrey Joshia
erotik izle
I do not even understand how I ended up here, but I assumed this publish used to be great. Tammy Husein Osgood
billye mckain
Hello! I could have sworn I’ve been to this blog before but after browsing through some of the post I realized it’s new to me. Anyways, I’m definitely happy I found it and I’ll be book-marking and checking back frequently!
gregg lippman
You made some nice points there. I looked on the internet for the subject matter and found most individuals will agree with your site.
valentin lewerke
You made some nice points there. I looked on the internet for the subject matter and found most individuals will agree with your site.
admin
Thanks.
travis thistlethwait
You made some nice points there. I looked on the internet for the subject matter and found most individuals will agree with your site.
mathilda schoborg
Hello! I could have sworn I’ve been to this blog before but after browsing through some of the post I realized it’s new to me. Anyways, I’m definitely happy I found it and I’ll be book-marking and checking back frequently!
best CBD oil for dogs
Thanks to my father who stated to me on the topic of this blog, this weblog is really awesome.
My website best CBD oil for dogs
CBD products
Thank you, I have just been searching for information about
this topic for ages and yours is the greatest I have discovered so far.
But, what about the conclusion? Are you positive concerning the source?
cannabidiol gummies
Excellent post but I was wanting to know if
you could write a litte more on this subject?
I’d be very grateful if you could elaborate a little bit
more. Many thanks!
best cbd for dogs
Interesting blog! Is your theme custom made or did you download it from somewhere?
A design like yours with a few simple adjustements would really make my blog jump out.
Please let me know where you got your theme. Kudos
casino utan svensk licens
It’s really a great and useful piece of info.
I am glad that you just shared this useful information with us.
Please keep us up to date like this. Thank you for sharing.
best THC vape carts
Thanks on your marvelous posting! I certainly enjoyed reading it, you happen to be a great author.
I will always bookmark your blog and definitely will come
back at some point. I want to encourage that you continue your great
writing, have a nice day!
admin
Thank you so much.
cannabis gummies
Neat blog! Is your theme custom made or did you download it from somewhere?
A theme like yours with a few simple adjustements would really make my blog jump out.
Please let me know where you got your design. Bless you
www.kitsapdailynews.com
I love your blog.. very nice colors & theme. Did you
create this website yourself or did you hire someone to do it
for you? Plz respond as I’m looking to design my own blog and
would like to know where u got this from. thanks a lot
admin
Thid website is created by me. Thanks for the appreciation.
hells kitchen
Quality posts is the secret to interest the people to pay a visit the
website, that’s what this website
is providing.
admin
Thanks for your beautiful comment.
check here
Wonderful blog you have here but I was wondering if you knew
of any discussion boards that cover the same topics discussed in this article?
I’d really love to be a part of group where I can get advice from other
knowledgeable individuals that share the same interest.
If you have any recommendations, please let me know.
Many thanks!
admin
Thanks. You can send a mail to us.
get more info
Having read this I thought it was rather informative.
I appreciate you spending some time and effort to put
this article together. I once again find myself spending a significant
amount of time both reading and leaving comments. But so what, it
was still worthwhile!
안전놀이터모음
Remarkable things here. I am very glad to look your post.
Thank you a lot and I’m taking a look forward to touch you.
Will you kindly drop me a mail?
admin
Ya sure.Thanks.
Idnpoker.Com
Wow, wonderful weblog format! How lengthy have
you been blogging for? you made running a blog look
easy. The total glance of your web site is excellent, as well as
the content material!
admin
Thanks
here
Hey There. I found your blog using msn. This is a really well written article.
I’ll make sure to bookmark it and return to read more of your useful information. Thanks for the post.
I’ll definitely return.
s128
I was recommended this website by my cousin. I’m not sure whether this post is written by him as no one else know such detailed about my problem.
You’re amazing! Thanks!
admin
We are glad that you liked our site. Thanks!
situs judi togel
I know this if off topic but I’m looking into starting my own weblog and was curious what all is required to get set
up? I’m assuming having a blog like yours would
cost a pretty penny? I’m not very web smart so I’m not 100%
sure. Any tips or advice would be greatly appreciated.
Thanks
admin
Hi. You can start your own Blog. Our Team is expertised in developing website/Blog. Please let us know if you want to Build by our Team.
Thanks!
www.old-account.com
Thank you for the auspicious writeup. It in fact
was a amusement account it. Look advanced to far added agreeable from you!
By the way, how can we communicate?
admin
Please send your suggestions/queries to us at vidyabhandar.com@gmail.com