FizzBuzz FizzBuzz is a well known programming assignment, asked during interviews. 1

FizzBuzz FizzBuzz is a well known programming assignment, asked during interviews.

n = int(input())

for x in range(1, n,2):
    if x % 3 == 0 and x % 5 == 0:
        print("SoloLearn")
        continue
    elif x % 3 == 0:
        print("Solo")
        continue
    elif x % 5 == 0:
        print("Learn")
        continue
    else:
        print(x)

Here is what the above code is Doing:
1. It’s taking input from the user.
2. It’s iterating over the range of numbers from 1 to n.
3. It’s checking if the number is divisible by 3 and 5.
4. If it is, it prints “SoloLearn”.
5. If it’s divisible by 3, it prints “Solo”.
6. If it’s divisible by 5, it prints “Learn”.
7. If it’s not divisible by 3 or 5, it prints the number.

Similar Posts