Skip to content

Instantly share code, notes, and snippets.

@rouseguy
Created August 22, 2017 07:09
Show Gist options
  • 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
@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