Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
FizzBuzz With WebMD
00:00
5 left

FizzBuzz With WebMD

EasyPython

Problem

Write a FizzBuzz variant where you replace Fizz with Web and Buzz with MD.

Implement fizz_buzz(n), which returns a list for integers from 1 through n. Use WebMD when a number is divisible by both 3 and 5, Web for multiples of 3, MD for multiples of 5, and the number itself otherwise. Return every list element as a string.

Constraints

  • 1 <= n <= 1000
  • The output contains exactly n strings
  • Numbers divisible by both 3 and 5 must produce WebMD

Function Signature

def fizz_buzz(n):
Interviewer

Your question is FizzBuzz With WebMD. Start with the requirements in the Question tab.

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.
CodePython 3
You need to log in / sign up to run or submit.Ln 2
Run your code to see test output here.