I'm new to coding and it's a little frustrating at the moment because i have to do an assessment where it outputs "1,2,fizz,4,buzz,fizz,7,8,fizz,buzz,11,fizz,13,14,fizzbuzz,16,17,fizz,19,buzz" and no i cant use print.
Code:
import sys
num1=int(input('Enter your number range: '))
for x in range(1,num1+1):
if x % 3 == 0:
print("Fizz",end=" ")
if x % 5 == 0:
print('Buzz',end=" ")
if x % 3 != 0 and x % 5 != 0:
print(str(x),end=" ")
Result: "enter your number range?"(well say 20)
1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 Fizz Buzz 16 17 Fizz 19 Buzz
so as you can see its on the same line but i don't want spaces, and i want commas in between each number and letter accept where number 15 should be, i want that to one word "FizzBuzz", as seen on the example :
1,2,fizz,4,buzz,fizz,7,8,fizz,buzz,11,fizz,13,14,fizzbuzz,16,17,fizz,19,buzz