Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

FizzBuzz in Python

EasyPython00:00
Practice interviewer
In session
5 left
00:00

Your question is FizzBuzz in Python. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Write a Python program that iterates integers from 1 to 50 and prints Fizz, Buzz, or FizzBuzz based on divisibility.

For grading, implement fizz_buzz() with no arguments and return a list containing the 50 output strings in order, where non-matching integers are represented as strings. Use FizzBuzz when a number is divisible by both 3 and 5.

Constraints

  • The function accepts no arguments.
  • Process each integer from 1 through 50 inclusive.
  • Return exactly 50 strings.
  • Use FizzBuzz for values divisible by both 3 and 5.

Function Signature

def fizz_buzz():
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output