Wednesday, April 16, 2014

Python Developer Interview Questions: Fizz-Buzz

Fizz-buzz is a very basic interview question mainly asked to see if a developer/programmer can actually code or not. Nothing too sophisticated.I was asked to code a FizzBuzz today for the second time in my life and I thought why not to blog about it, since it seems to be getting popular to ask from developers. To make it a bit challenging for myself, I coded it in Python, since I have the least skill in coding Python, although I think it is a sexy language.

Interview Question: Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”."

__author__ = 'amir'

for x in range(1, 100):
    if x % 15 == 0:
        print 'fizzbuzz'
    elif x % 3 == 0:
        print 'fizz'
    elif x % 5 == 0:
        print 'buzz'
        print x

Remark: Just remember that a number that is both divisible by three and five is also divisible by 15. Another note is that you need to check if the divisible by 15 condition first of all, if not they end up in divisible by 3 and 5 condition. Makes sense, right? :)


  1. Thank you very much, nice article to learn and it gives clear picture.
    Java Script training in chennai

  2. Python Training in Chennai with real-time corporate professionals. We are providing practical oriented best python training institute in Bangalore. Python Training in Bangalore |
    Pearson Vue Exam Center in Bangalore

  3. Thanks for one marvelous posting! I enjoyed reading it; you are a great author. Besant technology provides python course training in chennai

  4. It’s always so sweet and also full of a lot of fun for me personally and my office colleagues to search your blog a minimum of thrice in a week to see the new guidance you have got.

    Selenium Training in Bangalore

  5. Thanks for one marvelous posting! I enjoyed reading it; you are a great author. I will make sure to bookmark your blog and may come back someday. I want to encourage that you continue your great posts, have a nice weekend!
    DevOps Training in Bangalore

  6. Thanks a lot very much for the high quality and results-oriented help. I won’t think twice to endorse your blog post to anybody who wants and needs support about this area.

    Hadoop training in bangalore

  7. Day by day I am getting new things and learn new concept through your blogs, I am feeling so confidants, and thanks for your informative blog keep your post as updated one... AWS Training in Bangalore

  8. Very Nice Blog on Python Developer Interview Questions,
    Thank you for sharing kindly keep writing more about Python
    Thank you once again.
    Devops Training in Bangalore

  9. This comment has been removed by the author.

  10. This comment has been removed by the author.

  11. the blog is about Python Developer Interview Questions for more updates on python follow the link

    Python Online Training

    For more info on other technologies go with below links

    tableau online training hyderabad

    ServiceNow Online Training

    mulesoft Online Training

  12. This information is informative. Thanks for taking time to discuss this. QA Training Hub is best Python Programing Online Training Center in India. Python Online Training provided by real time working Professional Mr. Dinesh. Data Scientist and RPA Expert with 18+ years of industry experience in teaching Python. Best Python Online Training Contact: Mr. Dinesh Raju : India: +91-8977262627, USA: : +1-845-493-5018, Mail:

  13. the blog is about Python Developer Interview #Python it is useful for students and Python Developers for more updates on python follow the link

    Python Online Training Bangalore

    For more info on other technologies go with below links

    tableau online training hyderabad

    ServiceNow Online Training

    mulesoft Online Training

  14. very helpfull blog it was a pleasure reading your blog
    would love to read it more
    knowldege is not found but earned through hardwork and good teaching
    that being said click here to join us the next best thing in bangalore
    devops online training
    Devops Training in Bangalore

  15. Your blog was very interesting & easy to understand. Thank you so much sharing that valuable blog.. Internal Audit | Vendor Reconciliation | Fixed Assets Audit


  16. Those guidelines additionally worked to become a good way to recognize that other people online have the identical fervor like mine to grasp great deal more around this condition.

    Selenium Training in Chennai

    Aws Training in Chennai

  17. Hi Man,

    I love all the posts, I really enjoyed.
    I would like more information about this, because it is very nice., Thanks for sharing.

    First off I'm not a strong Python developer. I'm a Network Engineer and I use Python to create automation scripts for accessing routers and switches. I've never tried to convert a script of any type. A coworker asked me to help him convert a Perl script to Python. In my research and findings, I'm having some issues trying to find what I need in Python or even making it work.

    The Perl script accesses Cisco's Call Manager (phone system) webpage (https, authenication, ignore SSL), it pulls data off the pages, may be more than one with up to 2000 line items on each page. It then parses it (XML) into two columns, userID and extensions, and dumps it into a .CSV file. It then reads that .CSV file, accesses Microsoft Active Directory, looks up the userID and puts the extension of that userID into the persons Active Directory profile under the ipPhone attribute.

    The modules the Perl script uses are below vs what I've been trying to use in Python3...

    Net::LDAP; = python3-ldap3
    LWP::UserAgent; = urllib3
    LWP::Protocol::https; = requests
    XML::Simple; = lxml

    Any help would be appreciated. I'd like to know if I'm using the right equivalents of Python3 and any great examples on how to use these modules.

    So far,
    just even getting
    Python3 to "get" the URL, pass authentication credentials on the website and to ignore SSL cert has been really hard and frustrating. I'm not getting anywhere with that.

    THANK YOU!! This saved my butt today, I’m immensely grateful.


    Ajeeth kapoor

  18. Thanks a lot very much for the high quality and results-oriented help. I won’t think twice to endorse your blog post to anybody who wants and needs support about this area.

  19. And indeed, I’m just always astounded concerning the remarkable things served by you. Some four facts on this page are undeniably the most effective I’ve had. Best AWS Training in Bangalore

  20. Hi Your Blog is very nice!!

    Get All Top Interview Questions and answers PHP, Magento, laravel,Java, Dot Net, Database, Sql, Mysql, Oracle, Angularjs, Vue Js, Express js, React Js,
    Hadoop, Apache spark, Apache Scala, Tensorflow.

    Mysql Interview Questions for Experienced
    php interview questions for freshers
    php interview questions for experienced
    python interview questions for freshers
    tally interview questions and answers

  21. This comment has been removed by the author.

  22. This is a very helpful blog. would recommend it to everyone dabbling in Python.python training in Chennai

  23. This blog is the general information for the feature. You got a good work for these blog.We have a developing our creative content of this mind.Thank you for this blog. This for very interesting and useful.
    python training in chennai | python training in bangalore

    python online training | python training in pune

    python training in chennai | python training in bangalore

  24. Excellant post!!!. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.
    python training in tambaram
    python training in annanagar
    python training in jayanagar

  25. Hmm, it seems like your site ate my first comment (it was extremely long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I as well as an aspiring blog writer, but I’m still new to the whole thing. Do you have any recommendations for newbie blog writers? I’d appreciate it.

    Best Selenium Training in Chennai | Selenium Training Institute in Chennai | Besant Technologies

    Selenium Training in Bangalore | Best Selenium Training in Bangalore

    AWS Training in Bangalore | Amazon Web Services Training in Bangalore

  26. We are a group of volunteers and starting a new initiative in a community. Your blog provided us valuable information to work on.You have done a marvellous job!

    python interview questions and answers | python tutorialspython course institute in electronic city

  27. Thank you for taking the time to provide us with your valuable information. We strive to provide our candidates with excellent care and we take your comments to heart.As always, we appreciate your confidence and trust in us
    Java training in Bangalore |Java training in Rajaji nagar

    Java training in Bangalore | Java training in Kalyan nagar

    Java training in Bangalore | Java training in Kalyan nagar

    Java training in Bangalore | Java training in Jaya nagar

  28. Nice post, Thanks for sharing this with us.This information is very useful for the interview.For more information.
    aws online training
    aws training in hyderabad
    amazon web services(AWS) online training

  29. Thank you. Your blog was very helpful and useful For Me,Thanks for Sharing Best Python Online Training || Learn Python Course

  30. I’m thoroughly enjoying your blog. I as well as an aspiring blog writer, but I’m still new to the whole thing.
    nebosh course in chennai

  31. i am really reading in your well written article .It took like you Spend a lot of effort and time on your blog .Thank u For sharing .
    Blockchain Training In Hyderabad

  32. A small number of my blog audience have complained about my site not working correctly in Explorer but looks great in Safari. Do you have any ideas to help fix this problem?
    nebosh igc courses in chennai


  33. Nice blog..! I really loved reading through this article... Thanks for sharing such an amazing post with us and keep blogging...
    python online training
    Best python online training
    python online training in Hyderabad
    python online training in india

  34. Hey, would you mind if I share your blog with my twitter group? There’s a lot of folks that I think would enjoy your content. Please let me know. Thank you.
    AWS Training in Chennai
    Data Science Training in Chennai
    Python Training in Chennai

  35. Really great post, I simply unearthed your site and needed to say that I have truly appreciated perusing your blog entries.
    devops online training

    aws online training

    data science with python online training

    data science online training

    rpa online training

  36. Really great post, Thank you for sharing This knowledge.Excellently written article, if only all bloggers offered the same level of content as you, the internet would be a much better place. Please keep it up!
    Microsoft Azure online training
    Selenium online training
    Java online training
    uipath online training
    Python online training

  37. Good post
    Apponix Technologies

  38. From your discussion I have understood that which will be better for me and which is easy to use. Really, I have liked your brilliant discussion. I will comThis is great helping material for every one visitor. You have done a great responsible person. i want to say thanks owner of this blog.
    mongodb online training

  39. Hi, thank you very much for the new information, i learned something new. Very well written. It was sooo good to read and usefull to improve knowledge. Keep posting. If you are looking for any data science related information please visit our website data science course training bangalore.

  40. Hire python app developers to give your mobile app business a competitive advantage. Check online to find the best python developers.

  41. This is an amazing blog. Your blog is really good and your blog has always good thank you for information.

  42. Your blog has very useful information about this technology which i am searching now, i am eagerly waiting to see your next post as soonI just got to this amazing site not long ago. I was actually captured with the piece of resources you have got here. Big thumbs up for making such wonderful blog page!Java training in Chennai

    Java Online training in Chennai

    Java Course in Chennai

    Best JAVA Training Institutes in Chennai

    Java training in Bangalore

    Java training in Hyderabad

    Java Training in Coimbatore

    Java Training

    Java Online Training

  43. This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.I like it and help me to development very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.

    IELTS Coaching in chennai

    German Classes in Chennai

    GRE Coaching Classes in Chennai

    TOEFL Coaching in Chennai

    spoken english classes in chennai | Communication training

  44. Am Divya,Am really impressed about this blog because this blog is very easy to learn and understand clearly.This blog is very useful for the college students and researchers to take a good notes in good manner,I gained many unknown information.
    For more

    Data Science Training In Chennai

    Data Science Online Training In Chennai

    Data Science Training In Bangalore

    Data Science Training In Hyderabad

    Data Science Training In Coimbatore

    Data Science Training

    Data Science Online Training

  45. Awesome blog. Thanks for sharing such a worthy information....
    IELTS Coaching in Pune
    IELTS Coaching in Gurgaon

  46. Brooke Daniells :- Brooke Daniells is a popular and professional photographer from the United States of America

    Simeon Panda :- Simeon Panda is a true role model for anyone who wishes to achieve success in the field of bodybuilding.

  47. I appreciate your hard work. Keep posting new updates with us. This is really a wonderful post. Nice Blog Very interesting and useful information on your website. Thanks for sharing the blog and this great information which is definitely going to help us.

    Result of B.Com Examination for 1st 2nd 3rd Year
    BCom 1st year result 2022 | BCom 2nd year result 2022 | BCom 3rd year result 2022.

  48. That is very useful and informative blog. I really appreciate your efforts for writing this.Python Classes in Nagpur

  49. Thanks for sharing this here. Great Post, really it was very helpful for us. I found this blog to be very useful! python classes in satara