A PHP Error was encountered

Severity: 8192

Message: Function create_function() is deprecated

Filename: geshi/geshi.php

Line Number: 4698

Backtrace:

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4698
Function: _error_handler

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4621
Function: _optimize_regexp_list_tokens_to_string

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 1655
Function: optimize_regexp_list

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2029
Function: optimize_keyword_group

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2168
Function: build_parse_cache

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/Process.php
Line: 45
Function: parse_code

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/models/Pastes.php
Line: 517
Function: syntax

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 693
Function: getPaste

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once

Re: Re: Re: Re: fizzbuzz.py - Stikked
From Diminutive Cat, 9 Years ago, written in Python.
This paste is a reply to Re: Re: Re: fizzbuzz.py from Blush Agouti - go back
Embed
Viewing differences between Re: Re: Re: fizzbuzz.py and Re: Re: Re: Re: fizzbuzz.py
#!/usr/bin/python2

# http://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html
#
# Task:
#
# Write a program that prints the numbers from 1 to 100. 
# But for multiples of three print "Fizz" instead of the number and 
# for the multiples of five print "Buzz". For numbers which are multiples 
# of both three and five print "FizzBuzz". 
#

from sys import stdout

# fixed range
for i in range(1,101):
    divisible = False

    if i % 3 == 0:
        stdout.write("Fizz")
        divisible = True

    if i % 5 == 0: 
        stdout.write("Buzz")
        divisible = True
    
    if not divisible:
        stdout.write(str(i))
        
    stdout.write('\n')
    
# This solution only uses 2 modulus operations to work, instead of the 
# original post which had to compute 4 modulus operations.
#
# Using stdout instead of print allows you to omit printing the trailing newline
# character which the print function always prints, and makes it possible to 
# only use 2 modulus operations.
#
# If you have to output the number, then I think the cleanest way to do it is to
# use the divisible variable.  You can alternatively use nested if statements
# instead of the divisible variable, but I think it's not as readable as the
# above version.
#
# I think this solution is in the spirit of the task, especially since that
# Fizz, Bang, and FizzBang are printed INSTEAD of the number, not along with it 
# as in the original post.
U2FsdGVkX19h7ih8t3qnOObni5XooxP45/gMGN2QZPvB6Gp3155QCKbgRrpG7iFlyFbE0e4Yfe61r+VOAnpsZfC+KnLWv0TxhHK+
MSZpCYYm4nHA8QC4PY+iopO1N1z6R6HORKf6vK35XdaEYh3v5QfcMTNLpdB/gQ68l3npoPQaxv/ck+HlA0WI5QDduZzHW2jeJp56
nDwZzOK4dA/1TTSgvQ/AQKRkVTB6CwFxogAX4z1UgbDKVgAfAS3AStNy9E2PZRhw4PDTthhyyAf6C7DcaeLC3N2lvcmNAaPiFD1E
iA26z+Wvo3LPNfk/1sjY/U5MR4nJEipM8+hjo1QYo21yHczO2abM29PaN+pXLqNaJbfzYbz8VH+FUqQmifeaX8jNIMKx5uz4MPZP
AXbdMCKukVlBKg2vUb5gK5Q5uwE0gTb9FcoNNz5/sVnJXIogLUMKfx01O0B3sa8VSA4VSpNpecVF3NA498MxGEE9L/tOvLJk5NmZ
t12K8iYN/rrXSdqCDBx+v7HCRpBjNC+nvILfvHmWq/YdEdFYN6JbnbLITYDg/MlswtUd50c4AsptqPBeecIFvH4sVsV2IDLHb+DM
px3oi+nmjRseZFz3zHUtnLCCyN6unGwxSNvn882EkaZrf5SHjcc/9JCmJRUkC3gLPzgqBulYlrNBwWkYYm+5wyDasG1xyhY3gFwY
AGo2Qn3jk9kZ3jfS9t8jcKcLqldIT+LUaq5W5F0B4Z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