How to solve the FizzBuzz problem by python
Editor to share with you python how to solve the FizzBuzz problem, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!
60 characters solve FizzBuzz
Some time ago, Jeff Atwood promoted a simple programming exercise called FizzBuzz. The following questions are cited:
Write a program that prints a multiple of 1 to 100 Fizz 3 to replace this number, a multiple of 5 prints "Buzz", and a number that is both a multiple of 3 and a multiple of 5 prints "FizzBuzz".
Here is a short way to solve this problem:
For x in range (101x): print "fizz" [x% 3164fizz:] + "buzz" [x% 54th buzz:] or x is all the content of this article "how to solve the FizzBuzz problem by python". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!