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 Scorching Iguana, 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.
U2FsdGVkX1/S0hYoieN6J7Pcacxp6aWNuHHXEQ8JkcHSD2BCBdSOo1/jX6NBd7InvA0CzEoh82TejBojhKsCeRUU6Sk1Z9+UQGSM
yKOCdEx2m6M7TWbV47/Lz5lxvpRPfi6xSl5nwSFnjhNilP7NJ4A6k577i9osR/OK9n4mdV9bkRN3wR0oAtGa7vlicBO03GvGunDD
RHauvj5fBxXfOcbHguyOUL1UjFJlTagiKc7RW+K1J4VmCFytZDldYTzw/dMbEWSFxoh2kPxT5EY8cjBTz7GSH4obUtc9IJVU4Ytn
O0rhHv/ZIVGu0LBp8DCMHQPdN2N4NCMlVduyMBaL88jjsYJ9Xvx3Qpgi6IwK+jWgKuK7B3l8KkH2KCApvTm8kcSJZbqWuwXwzrHl
pZnio7HFOAlGsR1jwgOisARgPx4BsCW91n1o/bfVPiEA4OfwQ0JLfzzfnUd3taiwDinbv3cMagUIqP3qmn21cAeYmHnQIMRi/BMx
KkT9oM5KAbK3MOBq9eRvt9BBAaEjDzMmOhS74hsZXDjJqVDTeY6QC3tnCfeTkYsipud1/WirknXLjnm02PXtrRnmi2dFKCqEjctS
Gtvx83l0pKDl/nob5L8W+wcV/U1shLMQJh2w+KqK5lgLRso8T8fKw63UZAAGvK3ZtfXq5qdkxpwtUi/OAjl3CbeZT/RJCayzQ39w
Hj3B+IHBg6By9gAVPIbegXZsgU6twvAMzNT0Mg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