Skip to content

Instantly share code, notes, and snippets.

@zbrasseaux
Created April 30, 2020 18:58
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 zbrasseaux/61519a327e3c9bbbda8a92f76e7627ff to your computer and use it in GitHub Desktop.
Save zbrasseaux/61519a327e3c9bbbda8a92f76e7627ff to your computer and use it in GitHub Desktop.
# code to generate code seen in https://i.redd.it/azecoqeevyv41.jpg
MAX = 12
print("\n\ndef function(num1, sign, num2):")
for i in range(MAX - 1):
for j in range(MAX - 1):
print("\tif num1 == " + str(i + 1) + " and sign == '*' and num2 == " + str(j + 1) + ":")
print("\t\tprint('" + str(i + 1) + "*" + str(j + 1) + "=" + str((i + 1)*(j + 1)) + "')")
for i in range(MAX):
for j in range(MAX):
print("\tif num1 == " + str(i + 1) + " and sign == '/' and num2 == " + str(j + 1) + ":")
print("\t\tprint('" + str(i + 1) + "/" + str(j + 1) + "=" + str((i + 1)/(j + 1)) + "')")
for i in range(MAX):
for j in range(MAX):
print("\tif num1 == " + str(i + 1) + " and sign == '+' and num2 == " + str(j + 1) + ":")
print("\t\tprint('" + str(i + 1) + "+" + str(j + 1) + "=" + str((i + 1)+(j + 1)) + "')")
for i in range(MAX):
for j in range(MAX):
print("\tif num1 == " + str(i + 1) + " and sign == '-' and num2 == " + str(j + 1) + ":")
print("\t\tprint('" + str(i + 1) + "-" + str(j + 1) + "=" + str((i + 1)-(j + 1)) + "')")
@kevin-mc-kong
Copy link

This code is the pinnacle of scientific achievement in 2020, ++

@zbrasseaux
Copy link
Author

Thank you, much appreciated

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