@larrydanna/160713a-CleanCoders
Python3

No description

repl talk
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
def FizzBuzz(n):
	retVal = ''
	
	if n%15 == 0:
		retVal = 'FizzBuzz'
		
	elif n%3 == 0:
		retVal = 'Fizz'
		
	elif n%5 == 0:
		retVal = 'Buzz'
		
	else:
		retVal = n
		
	return retVal


def FizzBuzzV2(n):
	retVal = ''
	
	if n%3 == 0:
		retVal = 'Fizz'
		
	if n%5 == 0:
		retVal = retVal + 'Buzz'
		
	if retVal == '':
		retVal = n
		
	return retVal
	

def main():
	for i in range(1, 101):
		print(FizzBuzzV2(i))
	

def compareV1andV2():
	print('\nComparisson Started\n')
	for i in range(1, 101):
		v1Result = FizzBuzz(i)
		v2Result = FizzBuzzV2(i)
		if v1Result != v2Result:
			print('V1: ' + v1Result + ' <> V2:' + v2Result)
	print('\nComparisson Done\n')
	

print('App Start\n')

main()

compareV1andV2()

print('\nApp Done')

Python 3.6.1 (default, Dec 2015, 13:05:11) [GCC 4.8.2] on linux