create account

RE: Introducing the Coding Challenge by n4t3w

View this thread on: hive.blogpeakd.comecency.com

Viewing a response to: @reggaemuffin/introducing-the-coding-challenge

· @n4t3w ·
Here is my Python submission. Not the prettiest, but it works.

def FizzBuzz(n):
	fizz = False
	buzz = False
	r = 0
	if type(n) != int:
		r = type(n)
	elif n==0:
		r=0
	else:
		if n%3== 0:
			fizz = True	
		if n%5 ==0:
			buzz = True

			
	if fizz & buzz:
		r = 'FizzBuzz'
	elif fizz:
		r = 'Fizz'
	elif buzz:
		r = 'Buzz'
	else:
		r = n			
	print(r)
	return r
		

for i in range(0,101):
	FizzBuzz(i)

The spacing got messed up. So to run it, it will need some fixing.
properties (22)
authorn4t3w
permlinkre-reggaemuffin-introducing-the-coding-challenge-20170820t162023033z
categorycoding-challenge
json_metadata{"tags":["coding-challenge"],"app":"steemit/0.1"}
created2017-08-20 16:20:30
last_update2017-08-20 16:20:30
depth1
children0
last_payout2017-08-27 16:20:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length468
author_reputation49,667,465,108
root_title"Introducing the Coding Challenge"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id12,359,988
net_rshares0