Skip to content

Instantly share code, notes, and snippets.

@rouseguy
Created August 22, 2017 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rouseguy/3cdcf3fe0b6516608475c5f273abafe5 to your computer and use it in GitHub Desktop.
Save rouseguy/3cdcf3fe0b6516608475c5f273abafe5 to your computer and use it in GitHub Desktop.
import numpy as np
def fizzbuzz(number):
if number % 15 == 0:
return np.array(["fizzbuzz"], dtype="object")
elif number % 5 == 0:
return np.array(["buzz"], dtype="object")
elif number % 3 == 0:
return np.array(["fizz"], dtype="object")
else:
return np.array([str(number)], dtype="object")
fizzbuzz_vectorized = np.vectorize(fizzbuzz)
n = 30
input_data = np.array([a+1 for a in range(n)])
fizzbuzz_output = fizzbuzz_vectorized(input_data).ravel()
fizzbuzz_output
@raghothams
Copy link

raghothams commented Aug 22, 2017

def fizzbuzz(number):
    if number % 15 == 0:
        return "fizzbuzz"
    elif number % 5 == 0:
        return "buzz"
    elif number % 3 == 0:
        return "fizz"
    else:
        return str(number)
    
fizzbuzz_vectorized = np.vectorize(fizzbuzz)

input_data = np.arange(1,61)

fizzbuzz_vectorized(input_data)

@shrayasr
Copy link

Magic Holidays Ltd
Panoramic Group brings to you a truly magical Timeshare product "Magic Holidays".

The basic idea behind Magic Holidays is you can own tomorrow's holidays at today's prices. A one-time payment entitles you a week of holidaying at more than 6,500 resorts, for 25 years along with your 2 kids below 12 years of age. Further for your convenience, we have split the same into very affordable EMIs which are inflation-free.

@shrayasr
Copy link

Sir land at super cheap sir. Please contact 9742020706

@shrayasr
Copy link

Sir water at super cheap sir. Please contact 9742020706

@shrayasr
Copy link

Sir whatsapp marketting at very much of a cheap sir. Please contact 9742020706

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment