My friend seems to do python, so think about the problem ~ fizzbuzz ~

Long time no see. This is gorira. I wrote a problem with the famous fizzbuzz. If you don't understand, try searching with hints.

reference

python official manual If you pull this, you can see various examples. If you are in trouble because of a literal translation, please execute it appropriately. Let's decide whether to use it in the execution result. Since it's summer vacation, I studied Python with elementary school students --- Exercise 1 from FizzBuzz shakiyam There are people who are doing the same thing, so I can get on. I quoted it firmly.

Issue 1-1 Display from 1 to 20

Instructions

Let's make a program that displays 1 to 20. スクリーンショット 2020-02-11 15.18.05.png

Tips

The renge function is useful for producing consecutive numbers. Let's find out.

Exercise 1-2

Instructions

Let's make a program that displays 1 to 20. However, if it is a multiple of 3, display it as Fizz. スクリーンショット 2020-02-11 15.19.45.png

Tips To realize "If ...", use an if statement. Use "%" to find the remainder of the division in Python.

Challenge 1-3

Instructions

Let's make a program that displays 1 to 20. However, display Fizz for multiples of 3, Buzz for multiples of 5, and FizzBuzz for multiples of 3 and 5. スクリーンショット 2020-02-11 15.20.52.png Hint Note the order of if statements. Afterword When you are done, please go to Answer Commentary. We will update it one by one.

Recommended Posts

My friend seems to do python, so think about the problem ~ fizzbuzz ~
Think about how to program Python on the iPad
[Python] Try to read the cool answer to the FizzBuzz problem
The first algorithm to learn with Python: FizzBuzz problem
Think about the minimum change problem
Try to solve the fizzbuzz problem with Keras
Try to solve the Python class inheritance problem
[Python] Seriously think about the M-1 winning method.
The math of some entrance exam question is awkward to think about, so I left it to python after all
Sort in Python. Next, let's think about the algorithm.
Try to solve the internship assignment problem with Python
I tried to solve the problem with Python Vol.1
To do the equivalent of Ruby's ObjectSpace._id2ref in Python
A story about how to deal with the CORS problem
About the Python module venv
Think about architecture in python
About the ease of Python
About the traveling salesman problem
[Python] Solving the import problem due to the difference in entry points
The 15th offline real-time how to write reference problem in Python
I wanted to solve the ABC164 A ~ D problem with Python
The 14th offline real-time how to write reference problem in python
What to do when the value type is ambiguous in Python?
The 18th offline real-time how to write reference problem in Python