Can you write fizzbuzz in Python
- User
Can you write fizzbuzz in Python
- Assistant
Certainly! Here's an implementation of FizzBuzz in Python:
pythondef fizzbuzz(n): for i in range(1, n+1): if i % 3 == 0 and i % 5 == 0: print("FizzBuzz") elif i % 3 == 0: print("Fizz") elif i % 5 == 0: print("Buzz") else: print(i) # Example usage fizzbuzz(15)Output:
code1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.