0

How can a write a FizzBuzz program in Python?

2nd Nov 2020, 12:45 PM
Devansh Jhawar
11 Réponses
+ 2
Devansh Jhawar Ok so here's the code: n = int(input("Enter the ending number: ")) for x in range(1, n): if x % 3 == 0 and x % 5 == 0: print("FizzBuzz") elif x % 3 == 0: print("Fizz") elif x % 5 == 0: print("Buzz") Hope It helps :) If you have any queries, feel free to ask...
3rd Nov 2020, 7:07 PM
+ 1
Khalid Kotte Why is there a continue statement?? There's no Loop in the code! Continue & break statement is used only when in a Loop!!
1st Jan 2021, 5:31 PM
+ 1
n = int(input()) for x in range(1, n): if x % 3 == 0 and x % 5 == 0: print("SoloLearn") elif x % 2 == 0: continue elif x % 3 == 0: print("Solo") elif x % 5 == 0: print("Learn") else: print(x)
18th Mar 2021, 12:27 PM
Anointing Izuchukwu
0
Search the web dude, if you don't wanna write yourself!!!
3rd Nov 2020, 4:26 PM
0
I'd tried it from days and I'm not getting it right so I'm asking for a help. A small hint would be a great help bro.
3rd Nov 2020, 6:22 PM
Devansh Jhawar
0
Thanks a lot ADVIK for the answer. It truly helped me. I got to know where I was making mistake. Thank you once again
4th Nov 2020, 12:23 AM
Devansh Jhawar
0
Help me to solve this quiz, it tells me "expected an indented block in line 5"
17th Dec 2020, 2:27 PM
Khalid Kotte
18th Mar 2021, 6:12 PM
0
30th Apr 2021, 2:25 AM
- 2
n = int(input()) for x in range(1, n, 2): if x % 3 == 0 and x % 5 == 0: print("SoloLearn") elif x % 3 == 0: print("Solo") elif x % 5 == 0: print("Learn") else: print(x) #This is the correct answer
30th Apr 2021, 2:25 AM