Solve Fizz Buzz (equivalent to paiza rank C) in Python

at first

I was solving a collection of paiza level-up questions, but I didn't have a model answer, so I made it myself. The language is Python3.

problem

Paiza's skill check sample problem Fizz Buzz (equivalent to paiza rank C) https://paiza.jp/works/mondai/skillcheck_sample/fizz-buzz?language_uid=python3 I couldn't see the problem statement without logging in. Registration is free and can be done immediately, so I recommend you to register for the time being.

Answer code

fizz-buzz.py


N = int(input())

for i in range(1, N+1):
    if i % 3 == 0 and i % 5 == 0:
        print("Fizz Buzz")
    elif i % 3 == 0:
        print("Fizz")
    elif i % 5 == 0:
        print("Buzz")
    else:
        print(i)

For the explanation, click here [https://qiita.com/rA9-S/items/9d1c4108e23dae56bfce)

reference

https://qiita.com/KoyanagiHitoshi/items/3286fbc65d56dd67737c

Finally

Feel free to comment if you have any questions. I will answer as much as possible!

Recommended Posts

Solve Fizz Buzz (equivalent to paiza rank C) in Python
[With commentary] Solve Fizz Buzz (equivalent to paiza rank C) in Python
Solve word counts (equivalent to paiza rank C) in Python
Solve addition (equivalent to paiza rank D) in Python
Solve multiplication (equivalent to paiza rank D) in Python
Solve number sorting (equivalent to paiza rank D) in Python
Solve island hunting (equivalent to paiza rank S) in Python
Solve character matches (equivalent to paiza rank D) in Python
Solve mod7 fortune-telling (equivalent to paiza rank S) in Python
Solve the smallest value in Python (equivalent to paiza rank D)
Fizz Buzz in Python
Let's try Fizz Buzz in Python
I wrote Fizz Buzz in Python
Solve ABC036 A ~ C in Python
How to wrap C in Python
Solve ABC037 A ~ C in Python
Try to operate DB with Python and visualize with d3
[With commentary] Solve Fizz Buzz (equivalent to paiza rank C) in Python
I wanted to solve ABC159 in Python
Challenge Fizz Buzz! Problems with Python in 5 patterns (only now up to 398)
How to use the C library in Python
How to generate permutations in Python and C ++
Sorting AtCoder ARC 086 C hashes to solve in Ruby, Perl, Java and Python
Solve ABC146-C in Python
Next Python in C
Solve ABC098-C in Python
Solve ABC159-D in Python
C API in Python 3
Solve ABC160-E in Python
Try to make a Python module in C language
Solve Atcoder ABC176 (A, B, C, E) in Python
To do the equivalent of Ruby's ObjectSpace._id2ref in Python
Extend python in C ++ (Boost.NumPy)
To flush stdout in Python
Processing of python3 that seems to be usable in paiza
Solve Wooldridge exercises in Python
Binary search in Python / C ++
Solve ABC175 D in Python
Fizz Buzz in Python
Let's try Fizz Buzz in Python
I wrote Fizz Buzz in Python
Speech to speech in python [text to speech]
Object-oriented in C: Refactored "○ ✕ game" and ported it to Python
Solve optimization problems in Python
How to develop in Python
Post to Slack in Python
paiza Skill check past problem collection "C rank equivalent search history"
I want to solve APG4b with Python (only 4.01 and 4.04 in Chapter 4)
How to write offline real time Solve E04 problems in Python
Solve ABC163 A ~ C with Python
[Python] How to do PCA in Python
Convert markdown to PDF in Python
How to collect images in Python
Solve Atcoder ABC169 A-D in Python
In the python command python points to python3.8
Introduction to Protobuf-c (C language ⇔ Python)
Try to calculate Trace in Python
Solve ABC168 A ~ C with Python
How to use Mysql in python
How to use ChemSpider in Python
How to use PubChem in Python
Solve ABC162 A ~ C with Python
Solve ABC167 A ~ C with Python
Solve ABC158 A ~ C with Python