Skip to content

Instantly share code, notes, and snippets.

@jeremysmitherman
Created September 20, 2021 04:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeremysmitherman/5c08aa075546f7421906974174646052 to your computer and use it in GitHub Desktop.
Save jeremysmitherman/5c08aa075546f7421906974174646052 to your computer and use it in GitHub Desktop.
import time
import requests
base = "https://visualfractions.com/calculator/divisible-by/is-{}-divisible-by-{}/"
for x in range(1, 20):
print("Checking {} for fizzybuzziness".format(x))
by3 = False
by5 = False
r = requests.get(base.format(x, 3))
if "<strong>{} is also divisible by 3.</strong>".format(str(x)) in r.text.lower() or "<strong>{} is divisible by 3.</strong>".format(str(x)) in r.text.lower():
by3 = True
time.sleep(2)
r = requests.get(base.format(x, 5))
if "<strong>{} is also divisible by 5.</strong>".format(str(x)) in r.text.lower() or "<strong>{} is divisible by 5.</strong>".format(str(x)) in r.text.lower():
by5 = True
out = ""
if by3:
out += "fizz"
if by5:
out += "buzz"
if out != "":
print(out)
time.sleep(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment