Login Register


Challenge filter_list
Author
Message
Challenge #1
Hey there guys and gals. So i would just like to propose a challenge for you guys. I want to challenge you to make a FizzBuzz program. This will not be a contest, so no prize.
But try to make a program that prints all the numbers from 1 to 100 with the following exceptions:
1. for every number divisible by 3, you Write Fizz
2. for every number divisible by 5 you write Buzz
3. and for every number divisible by 3 AND 5 you write FIzzBuzz

Good luck, and have fun Smile feel free to post here if you are stuck xD

ps. to challenge you all further, try to make it as small as possible

Bronze 7. October 2018
Silver 12. October 2018

Reply

RE: Challenge #2
also, please post your code here when you are done Smile

Bronze 7. October 2018
Silver 12. October 2018

Reply

RE: Challenge #3
I remember doing this a long time ago in JavaScript. Simple and a good way to test your skills as a beginner Tongue
(This post was last modified: 10-05-2018, 11:02 PM by Jimbo39238.)

Reply

RE: Challenge #4
(10-05-2018, 11:01 PM)Jimbo39238 Wrote: I remember doing this a long time ago in JavaScript. Simple and a good way to test your skills as a beginner Tongue

why dont you give it a shot? xD

Bronze 7. October 2018
Silver 12. October 2018

Reply

RE: Challenge #5
tbh I have no experience in coding but good job with this post Biggrin

Reply

RE: Challenge #6
thanks Biggrin give it a shot anyways Biggrin

Bronze 7. October 2018
Silver 12. October 2018

Reply

RE: Challenge #7
Code:
a = 1 for i in range(100): if (a % 3) + (a % 5) == 0: print("Number:",a," FIzzBuzz") if (a % 3) == 0: print("Number:",a,"Fizz") elif (a % 5) == 0: print("Number:",a,"Buzz") else: print(a) a += 1
It was easy to do, I just didn't see this post earlier Biggrin
(This post was last modified: 11-01-2018, 09:42 PM by slothic. Edit Reason: So that it prints non-divisible numbers as well )

Reply

RE: Challenge #8
(11-01-2018, 09:40 PM)slothic Wrote:
Code:
a = 1 for i in range(100): if (a % 3) + (a % 5) == 0: print("Number:",a," FIzzBuzz") if (a % 3) == 0: print("Number:",a,"Fizz") elif (a % 5) == 0: print("Number:",a,"Buzz") else: print(a) a += 1
It was easy to do, I just didn't see this post earlier Biggrin
nice one. How do you like this?
Code:
print '\n'.join("Fizz"*(i%3==0)+"Buzz"*(i%5==0) or str(i) for i in range(1,101))
quite proud of this oneliner Smile

Bronze 7. October 2018
Silver 12. October 2018

Reply

RE: Challenge #9
(11-02-2018, 03:46 PM)oxnan Wrote:
(11-01-2018, 09:40 PM)slothic Wrote:
Code:
a = 1 for i in range(100): if (a % 3) + (a % 5) == 0: print("Number:",a," FIzzBuzz") if (a % 3) == 0: print("Number:",a,"Fizz") elif (a % 5) == 0: print("Number:",a,"Buzz") else: print(a) a += 1
It was easy to do, I just didn't see this post earlier Biggrin
nice one. How do you like this?
Code:
print '\n'.join("Fizz"*(i%3==0)+"Buzz"*(i%5==0) or str(i) for i in range(1,101))
quite proud of this oneliner Smile

Damn, I've never tried doing anything in one line. Looks good.

Reply

RE: Challenge #10
(11-02-2018, 03:46 PM)oxnan Wrote: nice one. How do you like this?
Code:
print '\n'.join("Fizz"*(i%3==0)+"Buzz"*(i%5==0) or str(i) for i in range(1,101))
quite proud of this oneliner Smile
Kinda weird you came up with a solution that already has been public in 2013  Tongue
http://michaeljgilliland.blogspot.com/20...ython.html

Reply







Users browsing this thread: 1 Guest(s)